This is a migrated thread and some comments may be shown as answers.

Loop through displayed rows

1 Answer 811 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johnathan
Top achievements
Rank 1
Johnathan asked on 01 Nov 2016, 02:15 PM

Hello,

Is there a way to loop through only the displayed rows of a radgrid, preferably on the client-side with javascript?

Thanks,

Johnathan

1 Answer, 1 is accepted

Sort by
0
Patrick | Technical Support Engineer, Senior
Telerik team
answered on 02 Nov 2016, 04:58 PM
Hello Johnathan,

One way is get a reference to the masterTableView, get the dataItems, and loop through each item.    In this case, I'm getting the cell under ProductName and the element.

Here is the JavaScript:
function Click() {
    var grid = $find("<%=RadGrid1.ClientID %>");
    var masterTable = grid.get_masterTableView()
    var dataItems = masterTable.get_dataItems();
    for (var i = 0; i < dataItems.length; i++) {
        console.log(dataItems[i].get_cell("ProductName").innerHTML);
        console.log(dataItems[i].get_element());
    }
}

I've attached a project which illustrates this approach.

Hope this helps!

Regards,
Patrick
Telerik by Progress
Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Tags
Grid
Asked by
Johnathan
Top achievements
Rank 1
Answers by
Patrick | Technical Support Engineer, Senior
Telerik team
Share this question
or