Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Work Tasks

On Selection Change

  • Last UpdatedJun 25, 2024
  • 2 minute read

Use scripts for the On Selection Change event of a control to accomplish a desired operation when the selection of the record for the control changes.

Data Grid

If you want to show the value from the column CountryName of the currently selected record in the Countries (G1) control for the Country Name (T1) control, then you can code the script for the On Selection Change event of the Countries (G1) control as follows:

// CountryName is the column name in the Countries data grid.

if (currentRowValue !== undefined)

{

control.findById("T1").value = currentRowValue.CountryName;

}

else

{

control.findById("T1").value = "";

}

Note: The DateTime column types would contain DateTime values (not String values), when the Use Culture Specific Values property is set to No.

Hierarchical Data Grid

If you want to show the value of the column oper_id of the Job data source from the hierarchical data grid ,then you can access it as follows:

//Here the WorkOrder is the parent lookup with the columns wo_id, wo_desc, and process_id. The Job is the child lookup with columns wo_Id, oper_id, and seq_no.

control.findById("T2").value = currentRowValue.WorkOrder.Job.oper_id;

control.findById("T1").value = currentRowValue.WorkOrder.wo_id;

Selection Lost Behavior

The current record selection is lost when:

  • The data grid is sorted or filtered.

  • The next or previous page of records is loaded in the data grid.

  • The form is reloaded.

  • The screen is changed in the mobile devices.

  • The screen is switched between web and mobile view.

  • The parametrized grid is refreshed.

    Note:
    - The currentRowValue method returns the value for the current selected record without the extended information.
    - The value of the currentRowValue method is undefined when the form loads and when the record selection is lost.
    - In a Data Grid configuration, if Disable Selection option is selected, then the On Selection Change event will fire only when the row is selected.
    It will not fire on paging, sorting, and filtering.

Tree

If you want to show an alert message when a node is selected and output the data of the selected node as the alert message, then you can code the script for the On Selection Change event of the control as follows:

//Show an alert dialog when a node is selected and output the selected node’s data as the alert message

window.alert(JSON.stringify(data));

The On Selection Change event passes a ‘data’ parameter which is a JavaScript object that contains the data values bound to the selected node.

In This Topic
TitleResults for “How to create a CRG?”Also Available in