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

Initial Grid Sort and Client side rebind

2 Answers 62 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.
Matt
Top achievements
Rank 1
Matt asked on 21 Mar 2012, 10:28 PM
Hi there,
I have a Grid that has Sorting enabled with an initial sort using the OrderBy method.
When I call the Client side rebind method for the Grid, the initial sort is dropped. Is this expected behavior? Is there some way that you can maintain this initial sort Client side?

2 Answers, 1 is accepted

Sort by
0
Matt
Top achievements
Rank 1
answered on 26 Mar 2012, 02:57 AM
Can any of the Telerik Admin's please answer this? If it is expected behavior then that's fine, or do you need more information from me?
0
Joe
Top achievements
Rank 2
answered on 16 Oct 2012, 08:16 PM

We are also having this grid rebind non-sorting problem.
The grid has methods which each return the data sorted in the same order as the OrderBy below.

.DataBinding(dataBinding => dataBinding
.Ajax()
.OperationMode(GridOperationMode.Client) // Retrieve ALL data to client.
.Insert("InsertAccountNote", "Reconcile")
.Update("UpdateAccountNote", "Reconcile")
.Select("SelectAccountNote", "Reconcile"))
.ToolBar(tb => tb.Insert().Text("Add Note").ButtonType(GridButtonType.Text))
.Sortable(sorting => sorting.OrderBy(sortOrder => sortOrder.Add(o => o.CreateDate).Descending()))

The problem we are having is that another button on the page can insert a row independent of the grid.
When that AJAX call returns we use the following to rebind sorted:

// SaveStatus ALSO inserts a row in the AccountNoteGrid, so refresh the grid now.
$('#AccountNoteGrid').data("tGrid").sort({ oobPositionId: oobPositionId });

Even this works initially.

The problem is when the user iterates between an insert from the Grid popup form and the insert from the independent butting and AJAX call.  Then the data starts showing with the most recent rows at the end of the last page with an unsorted chaotic look.

I wish that I could force the sort each time OnDataBinding fired.

Joe

 

 





Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Matt
Top achievements
Rank 1
Joe
Top achievements
Rank 2
Share this question
or