D'Arcy from Winnipeg
Solution Architecture, Business & Entrepreneurship, Microsoft, and Adoption

Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

Tuesday, June 17, 2008 12:50 PM

I'm banging my head on a wall here, and am looking for some insight. I have an Infragistics UltraWebGrid. It allows users to add Widget's to it (well, it doesn't, but we're going with a Widget metaphor here). Each row contains a Widget ID value and a Widget Type ID value. However, no two rows can have the same combination of Widget ID and Widget Type ID...they all must be unique.

So I'm using Javascript and the Infragistics client library to try and get this working. Below is the function...

You'll notice that I'm using the igtbl_GetFirstSibRow, as that is one of the methods Infragistics uses for navigating rows on the client (according to this kb article). So there is no "rows" collection of the grid, you have to manually go through the rows using "GetFirstSibRow" and "GetNextSibRow", etc.

Everything is fine until the line where I declare rowElem and assign it the value returned from the getFirstSibRow method. Now I've done some testing, and it does return an object...we're not getting null returned here. But later on in my while loop, when I attempt to get the value using rowElem.getCellFromKey( ), I'm getting the error message:

"Object doesn't support this property of method."

This is where I go WTF!? If getFirstSibRow is returning a grid row, shouldn't it have all the methods and properties of a row, including getValue and getCellFromKey?

You'll notice that I have a commented line in my code as well. That's there to show that I've tried using the method that way to fill the rowElem, and it doesn't work. I have to use the uncommented row.

Has ANYONE had success navigating through a grid's row collection on the client and been able to pull values out of each of the rows to assess them? Is there another way to access the rows collection of the UltraWebGrid that I'm unaware of which would remove the need to go through row by row using Next/Prev type of methods?

D




Feedback

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid


You probably want to download FireBug which is a FireFox addin, it will let you examine all of the JavaScript objects and their properties when the page is loaded.

This might give you some insight into what the object being returned looks like from a structure point of view.

- willyd
6/17/2008 7:16 PM | William

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

D'Arcy:

There is a client side Rows collection in the grid. It should be a property of the main WebGrid object.

var mygrid = igtbl_getGridById(gridName);
var rows = myGrid.Rows;

There is also a find function you can use to search the cells for a value. I think it searches all cells, not a specific column so that may not suite your needs.

If you can't get either of those to work, shoot me an email.

Devin 6/19/2008 7:29 PM | Devin Rader

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

I have just been working on the 'iterating through all rows' issue (in my case it is for some quick filtering on all columns client side).

For anyone who ends up here by searching for "iterating through UltraWebGrid rows", this is how I resolved it:

function doFilter(filterText) {
var grid = igtbl_getGridById('<%= UltraWebGrid1.ClientID %>');
var rId = 0;
var row = grid.Rows.getRow(rId++);
while (row) {
if (filterText == '')
row.setHidden(false);
else
row.setHidden(!row.find(filterText))
row = grid.Rows.getRow(rId++);
}
} 3/19/2009 4:37 AM | Andrew

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

Did you find the solution? If so can you let me know how to group the rows based on a column text.
Thanks 12/28/2009 8:45 AM | yash

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

Thanks Andrew for your solution. 11/26/2010 7:34 AM | Bhavan

# re: Help - Iterating Rows Client Side with Infragistics Ultra Web Grid

function CheckTheDuplicateValues(gridName, cellID, newValue)
{

var grid = igtbl_getGridById(gridName);
var rows = grid.Rows;
if(rows!=null)
{
var len = rows.length;
for(var i=0; i<rows.length;++i)
{
var row = grid.Rows.getRow(i);
if(row!=null)
{
var cell = row.getCell(10);
var cellval = cell.getValue();
if(newValue == cellval )
return true;
}
}
}

return false;
} 11/7/2011 7:04 PM | sunil Anikepati

Post a comment