Articles in this section
Category / Section

How to select the specific record in the grid using its primary key value

2 mins read

You can get the row index value for a particular record in a grid and select it with the help of its primary key value. This can be achieved by passing the required primary key value to the getRowIndexByPrimaryKey method which that returns the index value of the row. With the help of this row index value the particular record can be selected by using the selectRow method.

This is demonstrated explained in the below following code snippet and sample on button click event.

<script>
    // Get the row index and select record on button click
    button.element.onclick = () => {
          // Get the row index value using its primary key
          var index = grid.getRowIndexByPrimaryKey(10251);
          // Select the row using the index value
          grid.selectRow(index)
    };
</script>

 

Output

Select record with primary key value

You can find the samples here:

JavaScript (ES5) Sample: https://stackblitz.com/edit/jqmn1z

TypeScript Sample: https://stackblitz.com/edit/bae3vz-rzsk56

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied