Hi there. 

The goal is to adjust visibility of row toolbar Item depending on the value of the field of corresponding record. I added necessary column (ClvSaleStatus) to the list in Freedom UI designer, so all the changes to viewConfigDiff, viewModelConfigDiff and modelConfigDiff look to be present. But nevertheless, If i hide that column manually in the list page then corresponding attribute has undefined value and toolbar item is not visible

viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"name": "DataTable",
		"values": {
			"columns": [
				...
				{
					"id": "791d9bca-eac2-a585-0b1f-8ebacf4e2fa4",
					"code": "PDS_ClvSaleStatus",
					"path": "ClvSaleStatus",
					"caption": "#ResourceString(PDS_ClvSaleStatus)#",
					"dataValueType": 10,
					"referenceSchemaName": "ClvSaleStatus"
				}
			],
			"rowToolbarItems": [
				...
				{
					"type": "crt.MenuItem",
					"caption": "#ResourceString(ReserveObjectMenuItemCaption)#",
					"icon": "open-button-icon",
					"disabled": "$Items.PrimaryModelMode | crt.IsEqual : 'create'",
					"visible": "$Items.PDS_ClvSaleStatus | clv.IsObjectForSaleConverter",
					"clicked": {
						"request": "crt.ClvReserveObjectRequest",
						"params": {
							"itemsAttributeName": "Items",
							"recordId": "$Items.PDS_Id"
						}
					}
				}
			]
		}
	}
...
]/**SCHEMA_VIEW_CONFIG_DIFF*/
viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
	...
	{
		"operation": "merge",
		"path": [
			"attributes",
			"Items",
			"viewModelConfig",
			"attributes"
		],
		"values": {
			...
			"PDS_ClvSaleStatus": {
				"modelConfig": {
					"path": "PDS.ClvSaleStatus"
				}
			}
		}
	},
]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/
modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[
	{
		"operation": "merge",
		"path": [
			"dataSources",
			"PDS",
			"config"
		],
		"values": {
			"entitySchemaName": "ClvObject",
			"attributes": {
				...
				"ClvSaleStatus": {
					"path": "ClvSaleStatus"
				}
			}
		}
	}
]/**SCHEMA_MODEL_CONFIG_DIFF*/,
converters: /**SCHEMA_CONVERTERS*/{
	"clv.IsObjectForSaleConverter": function(value) {
		const result = value?.value == ClvJsConsts.ClvSaleStatus.ForSale;
		return result;
	}
}/**SCHEMA_CONVERTERS*/,
Like 0

Like

4 comments

Hi, here is an example of how to get the column value:

viewConfigDiff: /**SCHEMA_VIEW_CONFIG_DIFF*/[
			{
				"operation": "insert",
				"name": "DataGrid_3c1xo0k",
				"values": {
					----
					"columns": [
						------
						{
							"id": "a68e978a-790d-9af6-974e-c102ee0bd00e",
							"code": "DataGrid_3c1xo0kDS_Stage",
							"path": "Stage",
							"caption": "#ResourceString(DataGrid_3c1xo0kDS_Stage)#",
							"dataValueType": 10,
							"referenceSchemaName": "OpportunityStage"
						}
					],
					"rowToolbarItems": [
						{
							"type": "crt.MenuItem",
							"caption": "Test",
							"icon": "open-button-icon",
							"disabled": false,
							"visible": "$DataGrid_3c1xo0k.DataGrid_3c1xo0kDS_Stage | clv.IsObjectForSaleConverter",
							------
			},
-----
		]/**SCHEMA_VIEW_CONFIG_DIFF*/,
		viewModelConfigDiff: /**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/[
			{
				"operation": "merge",
				"path": [
					"attributes"
				],
				"values": {
					-----
					"DataGrid_3c1xo0k": {
						"isCollection": true,
						"modelConfig": {
							"path": "DataGrid_3c1xo0kDS"
						},
						"viewModelConfig": {
							"attributes": {
								"DataGrid_3c1xo0kDS_Title": {
									"modelConfig": {
										"path": "DataGrid_3c1xo0kDS.Title"
									}
								},
								"DataGrid_3c1xo0kDS_Stage": {
									"modelConfig": {
										"path": "DataGrid_3c1xo0kDS.Stage"
									}
								},
-----
					}
				}
			}
		]/**SCHEMA_VIEW_MODEL_CONFIG_DIFF*/,
		modelConfigDiff: /**SCHEMA_MODEL_CONFIG_DIFF*/[
			----
		]/**SCHEMA_MODEL_CONFIG_DIFF*/,
		handlers: /**SCHEMA_HANDLERS*/[]/**SCHEMA_HANDLERS*/,
		converters: /**SCHEMA_CONVERTERS*/{
			"clv.IsObjectForSaleConverter": function(value) {
				const result = value?.value == "test";
				return result;
			}
		}

Dmytro Vovchenko,

Well I didn't see any difference to mine code except that you are probably making it for detail and thus inserting new collection attribute "DataGrid_3c1xo0k" while my code is for section and thus merges new attribute to some collection attribute called "Items" which is added in BaseGridSectionTemplate schema.

Anyway, I solved my task by jsut making "clv.IsObjectForSaleConverter" async and requesting column value from db if it's hidden from the list

converters: /**SCHEMA_CONVERTERS*/{
	"clv.IsObjectForSaleConverter": async function(value, scope) {
		let result = value?.value == ClvJsConsts.ClvSaleStatus.ForSale;
		if (!result && !value) {
			const currentRecId = await scope.PDS_Id;
			if(sdk.isGuid(currentRecId)) {
					  const dataModel = await sdk.Model.create("ClvObject");
 
					  const filters = new sdk.FilterGroup();
 
					  filters.addSchemaColumnFilterWithParameter(sdk.ComparisonType.Equal, "Id", currentRecId);
 
					  const records = await dataModel.load({
						  attributes: ["Id", "ClvSaleStatus"],
						  parameters: [{
							  type: sdk.ModelParameterType.Filter,
							  value: filters
						  }
				]
					  });
					  const firstRecord = records[0];
					  const recSaleStatusId = firstRecord?.ClvSaleStatus?.value;
					  result = recSaleStatusId == ClvJsConsts.ClvSaleStatus.ForSale;
			}
		}
		return result;
	}
}/**SCHEMA_CONVERTERS*/,

 

Dmytro Vovchenko,

Ok, I rewrote viewModelConfigDiff to exactly match yours

{
	"operation": "merge",
	"path": [
		"attributes",
	],
	"values": {
		"Items": {
			"viewModelConfig": {
				"attributes": {
 
					"PDS_ClvSaleStatus": {
						"modelConfig": {
							"path": "PDS.ClvSaleStatus"
						}
					},
 
				}
			}
		}
	}
},

And it didn't help. If I hide column from the list => I get value argument of converter clv.IsObjectForSaleConverter as undefined. 

 

I looked into data saved to profile when hiding column from the list and it appears that it also modifies  viewModelConfigDiff and contains next snippet.

"viewModelConfigDiff": [
 
	{
		"operation":"remove",
		"path":[
			"attributes",
			"Items",
			"viewModelConfig",
			"attributes"
		],
		"properties":[
			"PDS_ClvSaleStatus"
		]
	}
]

 

The main point I experimented with is how to apply a converter in this line:

"visible": "$DataGrid_3c1xo0k.DataGrid_3c1xo0kDS_Stage | clv.IsObjectForSaleConverter"

When it was filled incorrectly, I saw the same problem behavior that you described. The example I provided should tell you how it needs to be filled. Please check this part in your code.

Show all comments

Hi 

 

Somebody know where can we change the message and graphics Creatio displays in a list page (Freedom & Classic pages) where no data? and the same in Next Steps?

 

Thanks

Julio

Like 1

Like

5 comments
Best reply

Julio.Falcon_Nodos,

I like to get rid of the graphic and also the "Nothing to show here!" text so I use the following: 

#next-steps-no-data-animation, 
.next-steps-no-data-main-label {
    display: none;
}

This changes it from this: 

To this: 

Ryan

I'd prefer not to have the graphics in these areas. I've been removing them with CSS, I believe that is the only option.

Ryan

Ryan Farley,

Thanks Ryan, which CSS need to modify to list pages and Next steps?

Julio.Falcon_Nodos,

I like to get rid of the graphic and also the "Nothing to show here!" text so I use the following: 

#next-steps-no-data-animation, 
.next-steps-no-data-main-label {
    display: none;
}

This changes it from this: 

To this: 

Ryan

Thanks!, I owe you a beer in Miami! :-)

Ryan Farley,

Dear Ryan, and to ListPages, when there no data? regarding Freedom pages?

Show all comments

Dear community,

Using "useThousandSeparator": false we can remove comma in section edit page or detail edit page. How do we do it in Section list Page?

 

Thanks

Like 0

Like

4 comments

Hello Shivani,

 

You can change the column format in prepareResponseCollectionItem method.

Here is a sample:

define("SomeSection", [], function() {
    return {
        entitySchemaName: "SomeSectionSchema",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
        methods: {
            prepareResponseCollectionItem: function(item) {
                this.callParent(arguments);
               
                var someColumn = item && item.columns && item.columns.SomeColumn;
                if (someColumn) {
                    someColumn.dataValueType = Terrasoft.DataValueType.TEXT;
                    item.set("SomeColumn", item.values.SomeColumn.toString());
                }
            }
        }
    };
});

 

Best regards,

Bogdan S.

Bogdan Spasibov,

That is fantastic Bogdan. Thanks for sharing this!

Ryan

This works for the section - is there a code for a detail on the contact page? I need to remove the comma from the year field here

Hi Heather, 

 

Please refer this post where this question was explained.

 

https://community.creatio.com/questions/special-character

 

The logic for section differs from page and there is no way to apply the property to the grid.

 

Regards,

 

Bogdan L.

Show all comments