Dynamically load diff elements

I'm having a scenario where I need to add two custom columns in attachment detail and need to edit that.So I have overridden the LinkPageV2 and added those two columns in diff.Now the fields are displaying in the required section attachment detail.However other section showing error in console stating that the columns are not found in that sectionFile Object

Is there a way to dynamically load diff based on the condition/for a particular section only?


Thanks,
Sivaranjani

Like 0

Like

2 comments

No, diff cannot be loaded based on conditions (only properties like visible or enabled can be changed using conditions, but not blocks of code).

The best approach is to add a boolean attribute on the LinkPageV2

attributes: {
	"IsForAccount": {
		dataValueType: Terrasoft.DataValueType.BOOLEAN,
		columnType: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
		value: false
	}
}

Then bind it to the visible property of the element in the diff

{ //...
    "visible": { "bindTo": "IsForAccount" }
}

On the page init check what the entity type is for the page and set the boolean: 

init: function() {
	this.callParent(arguments);
	this.set("IsForAccount", this.get("entitySchemaName") === "AccountFile");
}

Using this approach will work since the value will never get submitted when saved.

Ryan

Show all comments