3.2.0

Is there a way to hide a row?

I know I can just change my data array and refresh the grid, but so that I don't have to manage that much data is there a way to hide entire rows in the grid, possibly with just styles?
Chadd Whistler
February 25,
Can you give me more hints what you are trying to achieve? To delete the row without heavy full refresh or temporary hide and then show it again at some point?
Alex (ActiveWidgets)
February 25,
To leave the data there, but just not show the row.

My requirement is that I have a list of data items that I want to show in the grid. When the user clicks a separate control to indicate that they don't want to see records that are out of date for example then I want to just be able to set something on those rows so that they "disappear". When the user indicates that they want to see all of the records then I want to make them reappear.

I'm currently doing this by holding two Javascript arrays of my data. One full list and another with the records removed that would meet the "filter" criteria. When the user clicks the control then I just set the appropriate array into your grid and refresh it. This works fine but I now have to manage two sets of data so I would like to be able to simply "hide" those rows by setting the row height to 0 or something.
Chadd Whistler
February 25,
OK, I see.

The grid actually uses two data models - data and row. The first one (data) is responsible for the content itself while the second (row) defines the list of rows (indices) and their display order (sorting). So in order to display a subset of rows you just need to provide an array of row indices into the row model. For example to display just rows 1, 2 and 5 you need

obj.setProperty("row/values", [0,1,4]);
obj.refresh();

Alex (ActiveWidgets)
February 25,
Yes and you should use
obj.setDataProperty("count", 20);


in place of the regular

obj.setRowProperty("count", 20);


else grid will forget data-row-count...

http://www.activewidgets.com/messages/1609-2.htm
Sudhaker Raj
July 16,
Really wonderful example to hide/show rows in a grid.

Thanks Alex.
Kumar S
March 24,
I understand the use of:
obj.setProperty("row/values", [0,1,4]);
obj.refresh();

and I have implemented a table.response function to determine which rows I want to display (I'm using a CSV file to populate my grid).

The problem I have is that the table.response function does not appear to be triggered until I perform a document.write(obj) call and I don't know how to wait until the object has finished writing so that I can do the setProperty and refresh calls. If I add them to my table.response function they cause an error because the obj doesn't fully exist yet and if I add them immediately after the document.write then the variable I use to list the rows I want displayed hasn't been built yet in my table.response function.

How do I resolve this? Thanks
Nigel Shipley
March 24,
You write the object at load time but at the end of the assigned table.response function, call

obj.setRowCount(myData.length);
obj.refresh();

Where myData is the array you filled in the function.

Worked for me.

Bill Seddon
August 16,

This topic is archived.

See also:


Back to support forum