View Full Version : Grid sorted add

Jan 23, 2015, 10:10 PM
I am trying to add record to the grid. It works with:

Store.Insert(index, object)

but I want to record sort on insert. I am trying with:

Dim record As New ModelProxy(Store, Object)

but it does nothing. What I am doing wrong?

Jan 25, 2015, 2:43 PM
Maybe just by adding sorted to the list does not do it.

Look at this example: Multiple Grid Sorting Example (http://examples.ext.net/#/GridPanel/Paging_and_Sorting/Multiple_Sorting_Local/)

Maybe you can just implement what it does via code behind, or call the listener to sort after the directMethod to refresh the store.

I hope that helps your issue. If that's not the case then you can help us help you by providing a simple, working example of how to reproduce your problem. Then someone would try and suggest you a way to do that. :)

Jan 25, 2015, 7:39 PM
I am using Store.AddSorted method. That dont work in my case. That method is realy okward. It expect ModelProxy instead of object, I struggled until I found a way to convert object to ModelProxy so I can add it with AddSorted and all that mess-code did not worked. Then I gave up from AddSorted and now I am using Store.Insert(0, Object). New row is corectly positioned if grid is properly sorted.

So, for adding/editing and reposition to new/edited row I use:

Store.Insert(0, object)

Dim record As ModelProxy = Store.GetById(object.id)

Jan 25, 2015, 9:45 PM
Well, glad you made it work in the end.

It seems you are not the only giving up addSorted after all, and having success on another aproach: sencha/ExtJS: addSorted not working (http://www.sencha.com/forum/showthread.php?15963-addSorted-not-working)