How Disable option to delete & copy records in a Section in Freedom UI

Dear colleagues,

 

In Classic UI I can solve this by code, but in Freedom is also possible?, somebody know in which schema I need to do this and the related code?

 

Thanks & Regards

Like 1

Like

15 comments
Best reply

Note, when adding these back in, you'll need to make sure that the "items" and "primaryColumnName" values match the values from your list. For Section Lists. The "Items" and "PDS_Id" values need to be updated to match your List's property values - those can likely stay as-is for section lists, but for new lists added, you'll need to update those values. See for more: https://customerfx.com/article/adding-row-action-menu-items-to-a-creati…

and the same in a Detail (Freedom page)?

Hello Julio,

See this article here: https://customerfx.com/article/adding-row-action-menu-items-to-a-creati…

You can override the menu (usually to add other menu items to it). When you do so you override the "Open", "Copy", "Delete" options and need to add them back in. You could override the menu and then just only add back in the "Open" option. It would look like this (the article will provide more details)

viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
    {
        "operation": "merge",
        "name": "DataTable",
        "values": {
            //...,
            "rowToolbarItems": [{
                type: 'crt.MenuItem',
                caption: 'DataGrid.RowToolbar.Open',
                icon: 'edit-row-action',
                disabled: "$Items.PrimaryModelMode | crt.IsEqual : 'create'",
                clicked: {
                    request: 'crt.UpdateRecordRequest',
                    params: {
                        "itemsAttributeName": "Items",
                        "recordId": "$Items.PDS_Id"
                    }
                }
            }]
        }
        //...
    },
    //...
]/**SCHEMA_VIEW_CONFIG_DIFF*/

Essentially you're replacing the existing menu with one that only has the Open menu option. This works for any list (section or a list on a page)

Ryan

Ryan Farley,

Thanks Ryan, I promise I looked first, before to publish, in your articles, but didn't found this one. Thanks a lot

 

Regards

Julio

Ryan Farley,

Dear Ryan, I didn't found the crt.DataGrid element in the viewConfigDiff in the code of the listpage, I found it on a FormPage, but I need it also in a the ListPage

solved no need to search crt.DataGrid, jus add it on viewConfigDiff

Julio.Falcon_Nodos,

Yes correct. For the list page, the List (crt.DataGrid) exists in the parent page, you just need to merge in the changes.

Ryan

No worries - there's so much new info now with Freedom UI stuff, it's hard to know what to even search for!

Julio.Falcon_Nodos writes:

Ryan Farley,

Thanks Ryan, I promise I looked first, before to publish, in your articles, but didn't found this one. Thanks a lot

Regards

Julio

This could really do with being configurable using no-code tools, as it's quite cumbersome to apply to every list users will see but is often important - being able to copy records which should have to be created in specific ways is often an issue for business data.

Ryan Farley,

 

Hello again Ryan

 

How can I remove the delete option on a Freedom UI page , I see that when I add a detail only a FormPage is created, but there is no ListPage (like in Classic UI). So is it possible to solve this in a Freedom UI detail?

 

Julio.Falcon_Nodos,

Hi Julio, basically, any time you override the rowToolbarItems it replaces what is there with that you provide. Meaning, all the existing out of the box ones are gone. If you want no items there, you can just add and empty array:

rowToolbarItems: []

However, this has the annoying side effect of leaving an empty menu that pops up when the row actions button is clicked. I'm not sure if there's a property to remove the row actions button completely, so I usually just hide it with CSS.

Ryan

Ryan Farley,

Thanks Ryan, I'm already solved, but I want to maintain "Open", "Copy" and just remove "Delete", how can I did it?

solved... adding in "rowToolbarItems", this piece of code

"rowToolbarItems": [
  // Edit
  {
	type: 'crt.MenuItem',
	caption: 'DataGrid.RowToolbar.Open',
	icon: 'edit-row-action',
	disabled: "$Items.PrimaryModelMode | crt.IsEqual : 'create'",
	clicked: {
		request: 'crt.UpdateRecordRequest',
		params: {
			"itemsAttributeName": "Items",
			"recordId": "$Items.PDS_Id"
		}
	},
  },
  // Copy
  {
	  type: 'crt.MenuItem',
	  caption: 'DataGrid.RowToolbar.Copy',
	  icon: 'copy-row-action',
	  disabled: "$Items.PrimaryModelMode | crt.IsEqual : 'create'",
	  clicked: {
		  request: 'crt.CopyRecordRequest',
		  params: {
			  "itemsAttributeName": "Items",
			  "recordId": "$Items.PDS_Id",
		  },
	  },
  }                      
],

Note, when adding these back in, you'll need to make sure that the "items" and "primaryColumnName" values match the values from your list. For Section Lists. The "Items" and "PDS_Id" values need to be updated to match your List's property values - those can likely stay as-is for section lists, but for new lists added, you'll need to update those values. See for more: https://customerfx.com/article/adding-row-action-menu-items-to-a-creati…

Ryan Farley,

Is there any other way to hide the 3 dots for row action menu to even spawn

Pranshu Basak,

Sadly, removing all menu items does not remove the 3 dots button (in current versions, at least - hopefully that changes). For now I typically just hide it with some CSS.

Ryan

Show all comments