Use Data from Data Grid Set As Data Source
- Last UpdatedJun 25, 2024
- 1 minute read
You can set the Behavior property of a Data Grid to Data Source to use the data without showing the Data Grid control on the form.
Here we will use data from a Data Grid set as Data Source to set the Button Text for several buttons.
-
Create a lookup (Database, Repository List, or Web API).
-
Create a Grid Configuration using the lookup.
-
Create a form, and add a Data Grid control.
-
Modify properties of the Data Grid control as follows:
-
In the Basic tab, set the Configuration Name property to the grid configuration created in Step 2.
-
In the Advanced tab, set the Behavior property to Data Source.
-
-
Add a Text control and several Button controls to the form.
-
Modify the properties of the Text control as follows:
-
In the Scripts tab, set the script for the Value property as follows to set the Button Text with the Job_wo_id.
var numRec;
var ctrlId;
var dataSrc = control.findById("G1").source;
// Loop through the records returned.
if(dataSrc.length > 0)
{
for (i = 0; i < dataSrc.length; i++) {
numRec = i + 1;
ctrlId = "B" + numRec;
control.findById(ctrlId).buttonText = dataSrc[i].Job_wo_id;
}
}
// Return number of records.
return dataSrc.length;
-