Question

Row Unselected function

Hi,

I am using the rowSelected function on a detail to get the list of rows selected on a detail page. However, when a row is unselected, the list does not get updated.

 

Is there an equivalent function I can call for row UNselected?

define("UsrSchema00abbfacDetail", [], function() {
	return {
		entitySchemaName: "UsrManifestStops",
		details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
		diff: /**SCHEMA_DIFF*/[]/**SCHEMA_DIFF*/,
		messages: {
			"SandboxMessage_selectedDetailRows": {
        		mode: this.Terrasoft.MessageMode.PTP,
        		direction: this.Terrasoft.MessageDirectionType.PUBLISH
    		}
		},
		methods: {
 
				rowSelected: function(primaryColumnValue) {
					console.log("**********STOPS rowSelected START**********");
					this.callParent(arguments);
					var rowsSelected =  this.get("SelectedRows") + "; " + primaryColumnValue ;
					console.log("rowsSelected: "+ rowsSelected);
					this.sandbox.publish("SandboxMessage_selectedDetailRows", { value: rowsSelected }, ["SandboxMessage_selectedDetailRows"]);
					console.log("**********STOPS rowSelected END**********");
 
				}
		}
	};
});

 

Like 0

Like

4 comments

Hi Heather,

 

You need to modify the diff of your detail and add the following replacement:

{
					"operation": "merge",
					"name": "DataGrid",
					"values": {
						"unSelectRow": {"bindTo": "unSelectRow"}
					}
				},

and add the following method to your detail methods:

unSelectRow: function(e) {
					console.log(e);
				},

As a result once you unselect a row its Id will be logged in the console.

 

Best regards,

Oscar

Oscar Dylan,

Thank you very much. Does this work differently if it is an added-detail? I tried the way you wrote but it does not seem to get triggered if I add it as a merge after my insert statement. If I add it into the existing values list of my insert statement, I get an error that this.getGridData does not exist. If I add it as follows, it does not get triggered either.

 
//Does not get triggered
{
				"operation": "insert",
				"name": "UsrStops",
				"values": {
					"itemType": 2,
					"markerValue": "added-detail",
					"selectRow": {"bindTo": "rowSelected"}
				},
				"parentName": "Tab8ea35db5TabLabel",
				"propertyName": "items",
				"index": 0
			},
						{
				"operation": "merge",
				"name": "UsrStops",
				"values": {
					"itemType": 2,
					"markerValue": "added-detail",
					"unSelectRow": {"bindTo": "unSelectRow"}
				},
				"parentName": "Tab8ea35db5TabLabel",
				"propertyName": "items",
				"index": 0
			},

 

Heather,

 

This code should be added to the detail schema (the schema of the detail itself, UsrCustomDetail for example), it won't work for the detail page schema (the page that is opened once you double click a detail record, UsrCustomDetailPage for example). And this can be only applied to DataGrid (set of records returned by the detail), it cannot be applied to the page fields.

 

In your case it seems that you are adding this property to the detail declaration in the main page schema (for example you have the ContactCommunication detail and you are adding the property declaration to the ContactPageV2 schema), while it should be added directly to the ContactCommunicationDetail schema.

 

Best regards,

Oscar

Oscar Dylan,

Thanks very much, that worked. :)

Show all comments