This is a migrated thread and some comments may be shown as answers.

Rebind current page when row is removed

5 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bent
Top achievements
Rank 2
Bent asked on 26 Feb 2010, 03:02 PM
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

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 02 Mar 2010, 08:11 AM
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.
0
Bent
Top achievements
Rank 2
answered on 02 Mar 2010, 08:21 AM
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?
0
Yavor
Telerik team
answered on 05 Mar 2010, 07:12 AM
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.
0
Bent
Top achievements
Rank 2
answered on 05 Mar 2010, 11:26 AM
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
0
Yavor
Telerik team
answered on 10 Mar 2010, 11:56 AM
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.
Tags
Grid
Asked by
Bent
Top achievements
Rank 2
Answers by
Yavor
Telerik team
Bent
Top achievements
Rank 2
Share this question
or