Rebind current page when row is removed

6 posts, 0 answers
  1. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 26 Feb 2010 Link to this post

    I'm currently trying to rebind a RadGrid. Everything is done using JS and webservices.
    However, when the current selected row is removed and a rebind is performed, the grid is resetting to the first page.

    I have tried different approaces, but I can't seem to find a suitable solution.

    Is it a bug in the RadGrid, or am I supposed to handle this situation in some way.
    The same behavior is observed when calling tableView.removeSelectedItems().


    Thanks in advance
    Kenneth
  2. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 02 Mar 2010 Link to this post

    Hi Kenneth,

    When the control is rebound to data, after removing the required rows, you can set the CurrentPageIndex to the required page. This can be coupled with a flag, which would be cleared once the pageIndex is reset.
    I hope this suggestion helps. Let me know if further questions arise.

    Greetings,
    Yavor
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 02 Mar 2010 Link to this post

    It seems like some logic that shouldn't be my responsibility. The grid behaves a bit strange in this situation. I wouldn't expect it to rebind to page 1 in case the current item key disappeared.
    Do I also have to handle the situation where it's the last row on the page that is removed, and in this case move one page index back etc.?
    However, I will try your solution (which it looks like I have done earlier), but can I suggest this as a new feature then?
  5. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 05 Mar 2010 Link to this post

    Hi Kenneth,

    This extra step is required, due to the client side databinding, which you are using. Presently, this is not handled by the control automatically. I hope this is not causing you much inconvenience.

    Sincerely yours,
    Yavor
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
  6. Bent
    Bent avatar
    38 posts
    Member since:
    Sep 2008

    Posted 05 Mar 2010 Link to this post

    Well, the issue is a bit of a problem (but by no means critical - it's a "nice to have").
    I would appreciate some example of how I can achieve the needed functionality.

    I need a way to keep the current page and at the same time avoid binding the grid multiple times. When a row is removed, I think I need to keep the current page (or previous) index, and set that before the grid is bound, correct?

    Could I perhaps get some guidance to how I would go about implementing this?


    Kind regards
    Kenneth
  7. Yavor
    Admin
    Yavor avatar
    11 posts

    Posted 10 Mar 2010 Link to this post

    Hi Kenneth,

    To see more information on a possible approach to address this behavior, please refer to this example:

    http://demos.telerik.com/aspnet-ajax/grid/examples/client/databinding/defaultcs.aspx

    Essentially, you can use logic similar to the refresh method, which is called in the itemcommand handler.
    If this approach does not help, you can open a formal support ticket, and send me the imlementation for additional review.

    Greetings,
    Yavor
    the Telerik team

    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 Public Issue Tracking system and vote to affect the priority of the items.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017