Refresh Detail from Frontend

Hello Community,

I have developed a logic that when number of records in a detail is greater than 3 the plus sign dissappears

However my problem is that I have to refresh the whole page in order for the plus sign to dissappear. I have tried

this.reloadEntity() or this.UpdateDetail() method but without success.

Any idea how to overcome this problem

Best regards

Sasori

 

Like 0

Like

2 comments
Best reply

In the detail schema do the following:

 

1) Add attribute

attributes: {
	"IsAddVisible": {
		dataValueType: Terrasoft.DataValueType.BOOLEAN
	}
}

2) Add attribute to visible property of add button, add the following to the diff of the detail schema: 

diff: [
	{
		"operation": "merge",
		"name": "AddRecordButton",
		"values": {
			"visible": {"bindTo": "IsAddVisible"}
		}
	}
]

3) Add the following to methods: 

methods: {
	onGridDataLoaded: function() {
		this.callParent(arguments);
		this.setAddVisible();
	},
 
	subscribeGridEvents: function() {
		this.callParent(arguments);
		this.setAddVisible();
	},
 
	setAddVisible: function() {
		var items = this.getGridData().getItems();
		this.set("IsAddVisible", items.length < 3);
	}
}

End result, the add button should only be visible when the detail has less than 3 items.

Ryan

In the detail schema do the following:

 

1) Add attribute

attributes: {
	"IsAddVisible": {
		dataValueType: Terrasoft.DataValueType.BOOLEAN
	}
}

2) Add attribute to visible property of add button, add the following to the diff of the detail schema: 

diff: [
	{
		"operation": "merge",
		"name": "AddRecordButton",
		"values": {
			"visible": {"bindTo": "IsAddVisible"}
		}
	}
]

3) Add the following to methods: 

methods: {
	onGridDataLoaded: function() {
		this.callParent(arguments);
		this.setAddVisible();
	},
 
	subscribeGridEvents: function() {
		this.callParent(arguments);
		this.setAddVisible();
	},
 
	setAddVisible: function() {
		var items = this.getGridData().getItems();
		this.set("IsAddVisible", items.length < 3);
	}
}

End result, the add button should only be visible when the detail has less than 3 items.

Ryan

Thanks a lot Ryan. I was using ESQ before, but this is definitely faster and better.

Show all comments