All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Hello! I create radgrid data dynamically, and i don't even know how many columns it contains and column names are unknown.
The values are simple integers. The task is to calculate the summ of cells values of specific row. How can i iterate through columns
client-side javascript ?
You can loop through the column collection of the GridTableView to get names and how many. From there I would think you need to find the dataItem and then sum up the value in each element.
http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/client-side-programming/gridtableview-object/gridtableview-class-members
Not simple with a dynamic grid but doable.
Thank You, Craig. I've done it. Just Like This
01.
var
masterTable = $find(
"<%=RadGrid1.ClientID%>"
).get_masterTableView();
02.
count = masterTable.get_columns().length;
03.
row = args.get_row();
04.
cells = row.cells;
05.
sum = 0;
06.
07.
for
(
j = 0; j < count; j++) {
08.
09.
s = parseInt(cells[j].innerText);
10.
sum = sum + s;
11.
}
12.
alert(sum);