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

[Solved] Bug with ajax rebinding in new release

6 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Henry
Top achievements
Rank 1
Henry asked on 25 Mar 2011, 04:43 PM
When rebinding a grid it passes the value correctly the first time but upon wanting to run any actions on the grid it will revert to the default. Im assuming this is a bug as the demo's on here also suffer the same problem.

http://demos.telerik.com/aspnet-mvc/grid/selectionclientside

If you select a record on the top grid it updates the second grid but if you then reorder the second grid it will revert to its default value. Will this be addressed any time soon as dynamic selection is a very important feature. At the moment I am having to use session variables to track the changes (http://www.telerik.com/community/forums/aspnet-mvc/grid/manually-refresh-grid.aspx#1578857).

A response on this would be great.

6 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 Mar 2011, 04:53 PM
Hi Henry,

 This is actually not a bug. We changed the implementation of the rebind method. You can find more info here.

Kind regards,
Atanas Korchev
the Telerik team
0
Henry
Top achievements
Rank 1
answered on 25 Mar 2011, 05:07 PM
Ah I see, thank you for your response. Is there any reason that the automatic persistence was removed?

From my very brief look at it since your reply it seems that there is no way of accessing the currently selected ID of the grid so I will need to still manually track the selected ID which is what I did with the session variable. So this just means I could track it in javascript if i wanted to. Seems like an odd feature to drop, unless there is a way to get a currently selected ID?

Might be a good idea to update the demo as well :P

Thank you very much for your speedy response!
0
Atanas Korchev
Telerik team
answered on 25 Mar 2011, 05:17 PM
Hello Henry,

Previously the rebind method overwrote the internal url which was not expected. This also prevented sending complex objects or arrays as rebind arguments.

You can maintain the current selected id as a variable and use the OnDataBinding event to pass it:

OLD:

grid.rebind({foo : "bar"});

NEW
function dataBinding(args) {                       
    args.data = { foo : "bar" };
}


Regards,
Atanas Korchev
the Telerik team
0
Henry
Top achievements
Rank 1
answered on 25 Mar 2011, 05:32 PM
Yeah, thank you I saw that but the args don't seem to contain the currently selected ID which leads me back to manually tracking the changes. Im sorry to be such a pain but essentially what I need to do is:

(Sudo)
function dataBinding(args) {                       
    args.data = { foo : args.CurrentID };
}
And from what I can see, that value isn't stored within the args. Is there any way to access the currently bound ID?

Sorry if I'm just missing something really obvious!
Once again, thank you very much for your swift response.
0
Accepted
Atanas Korchev
Telerik team
answered on 25 Mar 2011, 09:08 PM
Hello Henry,

 I never said that the arguments will contain the current id. You can store it from the OnRowSelect in some variable.
var selectedID;

function onRowSelect(e) {
 selectedID = e.row.cells[0].innerHTML;
 childGrid.rebind();
}

function onDataBinding(e) {
   e.data = { selectedID : selectedID }
}

Regards,
Atanas Korchev
the Telerik team
0
Henry
Top achievements
Rank 1
answered on 26 Mar 2011, 11:18 AM
Yeah so like I said in my second post, manual tracking of the selected ID is now needed. I think I'll stick with using the session variable to track it. Thats a shame but thank you very much for all of your replies!
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Henry
Top achievements
Rank 1
Share this question
or