jQuery UI Widgets Forums Grid Aggregates not in getstate value?

This topic contains 4 replies, has 2 voices, and was last updated by  Nicolas 11 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Aggregates not in getstate value? #46438

    Nicolas
    Participant

    Hi,

    Here a problem I have with the method getstate of jqxGrid: it doesn’t return me the aggregates of a column. Here a jsFiddle of one of your aggregates’ example. At the end, I do a console.log() with the value of getState.

    http://jsfiddle.net/RksVn/1/

    This force me to call jqxGrid(‘columns’), and merge the result with the array returned by getstate. If I can do that, my aggregates won’t come back when I load back the grid.

    Aggregates not in getstate value? #46442

    Peter Stoev
    Keymaster

    Hi Nicolas,

    Aggregates are not State of a column and are not included in the column’s state for that reason. In general, saving/loading of a state should be performed on the same Grid instance so the Grid will load its old Layout, Sort, Filter, Page Number or Page Size i.e things which are dynamic.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Aggregates not in getstate value? #46445

    Nicolas
    Participant

    Ok. I’m using getstate to get a json object that I serialize before storing it in a database, so I can load it after when the user is reloading the page.

    So, does it means jqxGrid(‘columns’) will always returns more information about columns than jqxGrid(‘getstate’)?

    Aggregates not in getstate value? #46446

    Peter Stoev
    Keymaster

    Hi Nicolas,

    Neither the jqxGrid(‘columns’) or jqxGrid(‘getstate’) stores all information about your columns. All information about your columns is stored in the Columns Array from which you initialize the Grid. Sorry, but I still do not understand why you need to store the Aggregates. You don’t have to do that. When you reload your page, the Grid would be loaded again using your initial data and if you want to load its Old state, do it in the Grid’s “ready” callback.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Aggregates not in getstate value? #46490

    Nicolas
    Participant

    Here is why I need to do that : I first load a grid with initial data. Then, my users are able to modify to grid; they can change filter, sort, grouping, etc. They can also add aggragates that were not in my initial data. Then, they can save the result in the database to load back the page later.

    Of course, I could update my initial data to keep track of all the changes made by the user. But I don’t like this solution, because it makes my code more complex, and there always a risk that I forget to update my data. So this is why I just prefer to merge the values returned by getstate and columns.

    Thank you for your reply. Now I understand why getstate doesn’t returns the aggregates.

    Regards!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.