We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Search a specific row

Good evening.

I would like to select the row with Customer ID = "WANDK",  when I render it, as you can see in the below image.


How can I find the Customer ID "WANDK"? and how can I go to this page and select it?

I will be awaiting for your reply, thank you in advance.

Regards, Luis Carlos.

1 Reply

VN Vignesh Natarajan Syncfusion Team November 20, 2018 07:25 AM UTC

Hi Luis, 
Thanks for using Syncfusion products. 
Query: “search specific row 
From your query, we understood that you need to search a record and navigate to that page and select that record during the initial rendering itself. We have achieved your requirement using dataBound event gotoPage  and selectRows method  of ejGrid.   
Refer the below code example 
$(function () { 
                // the datasource "window.gridData" is referred from jsondata.min.js 
                dataSource: window.gridData, 
                allowPaging: true, 
                dataBound: function(args){ 
                 var rowIndex = args.model.dataSource.findIndex(x=>x.CustomerID == "WANDK"); //find the index of the value from dataSource 
                 var page = rowIndex / this.model.pageSettings.pageSize;  // calculate its page number 
                 if(page > 1) 
                   this.gotoPage(Math.ceil(page)); // navigate to that page 
                 this.selectRows(rowIndex % this.model.pageSettings.pageSize); // selcet the record using its index 
                columns: [ 
.                         .                  .                    .                      .                     .                      .  
From the dataSource we have found that index of the particular record and found the page using that value. We have navigated to that page using gotoPage() method and selected the row using selectRows() method 
For your convenience we have prepared a JS playground sample  
Refer our API documentation for your reference 
Note: provided solution will work only for local data, if you are using remote data or adaptor please get back to us more details regarding your dataSource. 
Vignesh Natarajan 

Live Chat Icon For mobile
Up arrow icon