CurrentPageIndex and DetailTables

6 posts, 0 answers
  1. Mats
    Mats avatar
    66 posts
    Member since:
    Aug 2006

    Posted 21 Jan 2010 Link to this post

    Hi!

    According to documentation the CurrentPageIndex is kept when a Rebind() of grid is performed.

    This seems to be true if the paging is done in the MasterTableView. If paging is done in a DetailTable the CurrentPageIndex will always be 0 when rebinding.

    Is this by design or should CurrentPageIndex be kept also for DetailTables at rebind?

    Thanks
    /Mats
  2. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 27 Jan 2010 Link to this post

    Hi Mats,

    If you have hierarchical RadGrid the CurrentPageIndex of the details table is kept into the DetailTables which is of type GridTableView like RadGrid's MasterTableView.
    If you want to get the value of the CurrentPageIndex from DetailTables you need to write the following code snippet:
    protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
       if (e.CommandName == RadGrid.PageCommandName)
       {
          GridPagerItem item = e.Item as GridPagerItem;
          GridTableView view = item.Parent.Parent.NamingContainer as GridTableView;
          int currentPageIndex = view.CurrentPageIndex;
       }
    }

    Additionally I am sending you a simple example which illustrates how to get CurrentPageIndex from the parent RadGrid and from details table.

    I hope this helps.

    Regards,
    Radoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Mats
    Mats avatar
    66 posts
    Member since:
    Aug 2006

    Posted 27 Jan 2010 Link to this post

    Hi Radoslav!

    Thanks for your answer and your example. But it does not really relate to my problem. I know how to access the CurrentPageIndex for detail table views.
    The problem for me is that when the grid is rebound then the CurrentPageIndex for detail tables will be cleared (0). Meaning that user will lose page selections (in detail tables) made before the rebind.

    To reproduce my problem in your example:
    1. Set RadGrid1.HierarchyDefaultExpanded=true.
    2. Add a button that will call RadGrid1.Rebind().
    3. Run example and change page of master table and one detail table.
    4. Press rebind button. Now the page index will be kept in master table but in detail table it vill be 0

    So my question remains. Is this by design or is it a bug?

    This is no longer a big issue for me since I've made my own saving and restoring of CurrentPageIndex for detail tables.

    Thanks
    /Mats

  4. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 29 Jan 2010 Link to this post

    Hi Mats,

    Thank you for getting back to us.

    I am afraid the described behavior is not a bug, but rather expected. By default when you rebind a parent grid table view in a hierarchical grid the state for the nested tables is lost. This is because the refresh action resets all previous settings applied for the nested controls to avoid ViewState inconsistencies/unexpected behavior.

    If you need further assistance, do not hesitate to contact us again.

    Sincerely yours,
    Radoslav
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Guillermo
    Guillermo avatar
    3 posts
    Member since:
    May 2014

    Posted 23 Jun 2015 Link to this post

    Hi Mats,

    Thank you for getting back to us.

    I am afraid the described behavior is not a bug, but rather expected. By default when you rebind a parent grid table view in a hierarchical grid the state for the nested tables is lost. This is because the refresh action resets all previous settings applied for the nested controls to avoid ViewState inconsistencies/unexpected behavior.

    If you need further assistance, do not hesitate to contact us again.

     

    Is there  a workaround to this, I'm trying to accomplish this very thing I and I find it impossible to set the details table pageindex after a parent rebind. Thank you,

    Guillermo

  6. Radoslav
    Admin
    Radoslav avatar
    1566 posts

    Posted 24 Jun 2015 Link to this post

    Hi Guillermo,

    Could you please elaborate a bit more on your scenario? What do you try to achieve? When do you want to set the pageindex of the details tables on some user action or initially? Do these detail tables are rendered and visible (parent item is expanded)?

    Looking forward for your reply.

    Regards,
    Radoslav
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top