Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Steve on Jun 11, 2008 00:09
open dhtmlx forum
Smart Rendering

If I have a dataset that is 50,000 records like in your examples for loading large datasets, is there anyway I can load the grid to show record 2343 (or any record somewhere in the middle) when it's first initialized?

I'm currently setting the posStart to equal 2343 (or any other number) on init, but the grid does not initialize to that record. I turned on debugging and it appears that it first tries to load 100 records from 2343, but then the grid immediately wants to load the first 100 records instead.

Thanks
Answer posted by Support on Jun 11, 2008 02:29
The grid build in such manner that it will load rows related to current view state, when grid initialized it not scrolled , so shows records 0..n , and even if you loading some data from middle of dataset it still request data for current view state which is rows from 0 to some defined limit.

You can try to use
    grid.loadXML('some_url',function(){
       grid.showRow(row_id2343);
    });

where some_url - url which return data starting from necessary pos ( 2343 )
and row_id2343 - id of row which need to be shown after loading.

With such code grid will load records starting from pos 2343 , scroll to record 2343 and still request data from 0 to 100, but it will be done after view scrolled, so it must not affect user experience.
Answer posted by Steve on Jun 11, 2008 11:36

That solution did not work.

It loads the records at 2343 and immediately loads the records from 0..100 but the grid does not scroll to 2343. 

I created a button that does mygrid.showRow('2343') and whenever I click on it after the page initializes, nothing happens.  Once I scroll down to 2343 (does not query database since it was downloaded on init), the row renders and from that point on I can click on my button to show row 2343.  So it seems like the row has to be rendered before the grid will actually move.

I tested this out for row 55.  On initialization, I load records from 0->100, but only records 0->14 are rendered.  When I click my button to go to row 55, nothing happens.  I scroll down until row 55 renders, then scroll back to the top and click on my button and now the grid moves to row 55.  Therefore, I need a way to move to a row before it has been manually rendered on my screen.

Thanks

Answer posted by Support on Jun 12, 2008 02:29
Please check attached sample, it uses the same approach and works correctly. ( please beware that it uses static XML, so it not really fully functional )

After additional checking the problem with above scenario was confirmed for IE, which really not focus row until it fully rendered.
Attached sample contains fixed file for standard edition, if you need the same fix for pro version - please contact us directly at support@dhtmlx..com ( it will be included in online package as well )
Attachments (1)