Grid sorted add

  1. #1

    Grid sorted add

    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)
    Store.AddSorted(record)

    but it does nothing. What I am doing wrong?
  2. #2
    Maybe just by adding sorted to the list does not do it.

    Look at this example: Multiple Grid Sorting Example

    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. :)
  3. #3
    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)
    Grid.GetSelectionModel.Select(object.id)

    Dim record As ModelProxy = Store.GetById(object.id)
    record.Set(object)
    record.Commit()
    Grid.GetSelectionModel.Select(object.id)
  4. #4
    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

Similar Threads

  1. [CLOSED] I don't want Sorted in Store
    By osef in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Nov 27, 2013, 1:40 AM
  2. Replies: 5
    Last Post: Dec 19, 2011, 3:27 PM
  3. GridPanel sorted only in ascending mode
    By Dominik in forum 1.x Help
    Replies: 0
    Last Post: Feb 15, 2011, 1:06 PM
  4. Replies: 0
    Last Post: May 19, 2009, 5:16 AM
  5. How to sorted by multiple fields?
    By bruce in forum 1.x Help
    Replies: 0
    Last Post: May 04, 2009, 4:10 AM

Posting Permissions