On Data Bound
- Last UpdatedJun 25, 2024
- 1 minute read
Use scripts for the On Data Bound event of a Data Grid control to accomplish a desired operation when data is bound to the Data Grid control. For a Hierarchical Data Grid, On Data Bound is triggered on expansion of each row.
Data Grid and Hierarchical Data Grid
If you want to select the second record in the Projects (G1) control when data is bound to the Projects (G1) control, then you can code the script for the On Data Bound event of the Projects (G1) control as follows:
// Select the second record in the Projects data grid.
var kGrid = e.sender;
var row = kGrid.tbody.find("tr").eq(1);
kGrid.select(row);
Note:
- The On Data Bound event of a Data Grid control is triggered every time the page is updated or when the grid is sorted or
filtered.
- The On Data Bound event of a Data Grid control is triggered every time the grid is viewed in mobile view or in a mobile
device.
- The On Data Bound event is fired only once on row expansion while on the same page.
Tree
If you want to change the text of the first node in the Projects (T1) control when data is bound to the Projects (T1) control, then you can code the script for the On Data Bound event of the Projects (T1) control as follows:
//Change the text of the first node in the tree
data[0].text = "Node 1";
For more information, see Showing Icons in Data Grid Columns.