3.0 beta 2

Turn Virtual Mode On/Off Dynamically?

Hello,

I'm using a V2B4 XML Table (AJAX) & UI Grid. Based on the user's attribute, he/she may see 20 rows where as another user may see 1,000.

Is there a way to set the obj.VirtualMode to false/true based on the count of the table being loaded? Obviously a virtual grid for 20 rows is not ideal ~ nor is a non-virtual grid for 1,000 rows.

Thanks in advance!
Sam S.
January 31,
Try sthg like

obj.setVirtualMode(obj.getRowCount() > 20 ? true : false);


I haven't tested it, but should be ok

Grangreg
January 31,
but if number of rows is > 20, why do you want to turn off virtualmode??? It shouldn't bother you for 20 lines...
Grangreg
January 31,
Perhaps 20 was a bad example... say 100.

In my scenario, we are loading employee names in the grid. So when a user is scrolling down the list in virtual mode looking for a specific employee's name, the grid has to constantly "pause" to let the new rows display. When virtual is off, you can fly up and down the grid without any pauses.

In theory, my preference would be to never use Virtual Mode because of this "choppy" feel when going up/down the grid. But having the user wait for thousands of records to load is not practical either.

So in my opinion, I think Virtual Mode is only ideal if there are a large amounts of data being displayed.
Sam S.
January 31,
Grangreg:

Thanks for the help, but it wasn't working for me with AJAX-loaded XML data. I'll keep playing with it.
Sam S.
January 31,
Ok sam, now I get your point, but personnally, I like the virtual mode, cause it's a huge improvement ...

But feel free to use it as you like...

What I'd do in your case would be a search feature in which you type the name of employee, and the grid automatically scrolls to it...

Grangreg
January 31,
I've placed a checkbox on a form for switching virtual mode on and off and it does make the change to the grid properly (I can tell whether it is in virtual mode or not), but with bad side-effects.

function gridVirtual( chk )
{
gridCdmItems.setVirtualMode( chk );
gridCdmItems.refresh();
}
I've had the grid freeze, displaying only every other row with the column data all bunched up in the area of the first column of the grid, or displaying the first 12 or so rows of the grid properly and the rest of the rows (400 or so) showing a row number in two columns and no data in other columns. I suppose something is not being set up properly.

Jim D.
January 31,
Are you seeing this behavior with Beta 4? There were some update issues with earlier Beta versions but they should be fixed in Beta 4. That is what Beta software is for, identifying oddities and getting them fixed. It is not that good to re-architect your application based on behavior seen in early beta. You should design your software with the assumption that it will work correctly in the release version.
Jim Hunter
January 31,
The problems I see are with 2.0b4.
Jim D.
January 31,
Jim D.,

Are you suggesting that V2 B3 Virtual Mode functioned better? I haven't really tested my code with B3 - so just curious.

Thanks.
Sam S.
February 1,
Sam,
I've only tested with 2.0b4.

I have it working now per Jim Hunter's suggestions. I do a grid.clear(), then set up the grid again as though it is being loaded for the first time (setCellText, etc), and this makes the transition between virtual mode and non-virtual mode work OK. It's possible that not all of the steps are needed to make the transition successfully.
Jim D.
February 1,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.