Prevent editing the object from grid configuration? #13716
Closed
prunepal333
started this conversation in
General
Replies: 2 comments 1 reply
-
From the above grid, I am able to edit the description and title field, which needs to be disabled even for admin user. |
Beta Was this translation helpful? Give feedback.
1 reply
-
You could do this with an event listener that checks that the opened object is a folder and then immediatly deactivate the input if the user clicks on it : // startup.js
// After opening a dataobject
document.addEventListener(pimcore.events.postOpenObject, (e) => {
// FOLDER
if (e.detail.object.data.general.o_type === "folder") {
// Getting the panel containing the grid
const panel = Ext.getCmp(object.search.layout?.id);
if (!panel) {
return;
}
// Will execute when the grid appears in the dom
const mutations = new MutationObserver((mutation) => {
if (panel && panel.el.dom && mutation[0].addedNodes[0]?.id?.startsWith("celleditor")) {
mutation[0].addedNodes[0].querySelector('input').disabled = true;
}
// TODO : handle boolean type, relation type...
})
mutations.observe(panel.el.dom, {
childList: true,
subtree: true,
})
}
}); This should give you a good start |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am unable to find the solution of preventing the user from editing the object from grid configuration.
What I want is only allow the user to edit the object in detail view.
Beta Was this translation helpful? Give feedback.
All reactions