Quantcast

how to Refresh DataGrid and scroll to old position?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to Refresh DataGrid and scroll to old position?

srinuetta
Hi All,
i want Refresh DataGrid and scroll to old position which i actually selected before refresh.
i have some unique number in my item to select bute how to handle multiple selection?

regards
Srinu
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

Mahes
This post has NOT been accepted by the mailing list yet.
Hi
gird._refresh() will help you to refresh the grid. For selection you may need to do it programtically

Thanks
Mahes
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

Evan
In reply to this post by srinuetta
Yes, you can use grid.scrollToRow(rowIndex) for scrolling to the selected row.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

Eric Pasquier
Hi Evan.

I was not the original writer of this post, but I tried this to.
These is a bug in the pageRow calculation, may be due to the fact that rows
content is not loaded yet. In this case, the algorithm use the default
height for intermediate pages (600 or 800 px if I remember), and this leads
to a wrong row position.

I found a workaround, by using a timeout to make a second call :

  dojo.addOnLoad(function() {
  var oldPos = dojo.cookie("GridScrollPos");
    gridData.setScrollTop(oldPos);
    setTimeout(function(){
      gridData.setScrollTop(oldPos);
    },
    100);

  });

  dojo.addOnUnload(function() {
    var LscrollTop = gridData.scrollTop;
    dojo.cookie("GridScrollPos", LscrollTop, {expires: 1});
  });


This seems to be the same if you move the scroll bar quickly to the end of
the table and release the mouse: the scroll bar moves back, and the last row
is not shown.

Eric.


-----Message d'origine-----
De : [hidden email]
[mailto:[hidden email]] De la part de Evan
Envoyé : mardi 4 janvier 2011 06:39
À : [hidden email]
Objet : Re: [Dojo-interest] how to Refresh DataGrid and scroll to old
position?


Yes, you can use grid.scrollToRow(rowIndex) for scrolling to the selected
row.
--
View this message in context:
http://dojo-toolkit.33424.n3.nabble.com/how-to-Refresh-DataGrid-and-scroll-t
o-old-position-tp2026298p2189974.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

ismaeljohnson11
This post has NOT been accepted by the mailing list yet.
In reply to this post by srinuetta
hi
[url=http://www.iqpower.net]solar power Orlando[/url] - [url=http://www.iqpower.net]water heating solar[/url] - [url=http://www.iqpower.net]solar Orlando[/url]
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

alaska
In reply to this post by Eric Pasquier
The method I've used to do this relies on a bit of hidden functionality in the DataGrid:

----
grid._lastScrollTop=grid.scrollTop;                                                                                                                                                  
grid._refresh();
----

It works perfectly, but it will make two requests to the datastore.  One for the standard first pull (beginning at 0), another for the data corresponding to your current position.

If anyone knows of a method to get around that, please post it.

Eric Pasquier wrote
Hi Evan.

I was not the original writer of this post, but I tried this to.
These is a bug in the pageRow calculation, may be due to the fact that rows
content is not loaded yet. In this case, the algorithm use the default
height for intermediate pages (600 or 800 px if I remember), and this leads
to a wrong row position.

I found a workaround, by using a timeout to make a second call :

  dojo.addOnLoad(function() {
  var oldPos = dojo.cookie("GridScrollPos");
    gridData.setScrollTop(oldPos);
    setTimeout(function(){
      gridData.setScrollTop(oldPos);
    },
    100);

  });

  dojo.addOnUnload(function() {
    var LscrollTop = gridData.scrollTop;
    dojo.cookie("GridScrollPos", LscrollTop, {expires: 1});
  });


This seems to be the same if you move the scroll bar quickly to the end of
the table and release the mouse: the scroll bar moves back, and the last row
is not shown.

Eric.


-----Message d'origine-----
De : [hidden email]
[mailto:[hidden email]] De la part de Evan
Envoyé : mardi 4 janvier 2011 06:39
À : [hidden email]
Objet : Re: [Dojo-interest] how to Refresh DataGrid and scroll to old
position?


Yes, you can use grid.scrollToRow(rowIndex) for scrolling to the selected
row.
--
View this message in context:
http://dojo-toolkit.33424.n3.nabble.com/how-to-Refresh-DataGrid-and-scroll-t
o-old-position-tp2026298p2189974.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

_______________________________________________
FAQ: http://dojotoolkit.org/support/faq
Book: http://docs.dojocampus.org
[hidden email]
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

dichotomy
grid.sort();
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to Refresh DataGrid and scroll to old position?

dichotomy
I apologize, I had my head buried in a situation of refreshing a grid with an ObjectStore wrapped custom JsonRest store... my post is out of context and unhelpful to the idea of restoring a grid to a scrolled location on page load (although, grid.sort() is a "public" method of refreshing).
dichotomy wrote
grid.sort();
Loading...