Is there a way to prevent users from changing column arrangement via roles?

We need to manage users such way, so they are unable to change table/grid arrangement unless they have specific role.

Like 0

Like

7 comments

Would this be for a Freedom UI list or a classic list?

Ryan Farley,

Freedom UI

Davit Gharagebakyan,

I believe currently there's no way to do this without some some CSS tricks. I typically add some code that executes globally and adds an attribute to the body tag - in this case you'd check if the user is a member of a role, then add the tag, so the body is something like this:

<body user-is-admin="true" .... >

Then add CSS globally that will only apply if that attribute is true. 

Here's an article with a similar approach that does this for portal (external) users only (instead of checking if the user is a portal user, you'd check if the user is in the role) https://customerfx.com/article/applying-global-css-styles-in-the-creatio-portal-formerly-bpmonline/

As far as the CSS to hide the ability to modify the list columns, that would be this (assuming you want this to apply to all lists) - Note, this HIDES the ability to edit the list layouts:

crt-data-table crt-button[data-qa="add-columns-button"], 
crt-data-table crt-button.crt-column-toolbar {
    display: none;
}

Ryan

Thank you very much. Worked for me

Looks like you can find all of the possible options for setting these grid list features in the code by adding a breakpoint (I found this by searching for "features.columns." using Chrome's search all sources feature, ctrl+shift+f):

 

e.g. I have disabled row toolbars, column toolbars (the ones you get by clicking on each column's 3 dot menu), resizing, rearranging (dragAndDrop), and sorting, and these all take effect as expected and make the list basically static & read only. Currently working on 8.1.3.

 

Example of the page code to apply this for me:

			{
				"operation": "insert",
				"name": "DataGrid_p5zr1sl",
				"values": {
					"type": "crt.DataGrid",
					"features": {
						"rows": {
							"selection": false,
							"numeration": false,
							"toolbar": false
						},
						"editable": {
							"enable": false,
							"itemsCreation": false
						},
						"columns": {
							"adding": false,
							"toolbar": false,
							"dragAndDrop": false,
							"editing": false,
							"resizing": false,
							"sorting": false
						}
					},
					/* rest of the data grid setup */
				}
			}

Thanks for your insight, but that will not work for me, because that construction does not support "$Attr" values, only constants

Davit Gharagebakyan,

That's frustrating, didn't realise that as my current use case is consistent for all users. Would be good to be able to control these via attributes though, Creatio!

Show all comments