jQWidgets Forums

jQuery UI Widgets Forums Grid Preparing grid before showing it

This topic contains 2 replies, has 2 voices, and was last updated by  tvenable.mie 8 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Preparing grid before showing it #87332

    tvenable.mie
    Participant

    I’m having a dilemma of how to handle something with the grid. I want to prepare a grid before showing it to a user. By “prepare” I mean: #1 – retrieve information from our server about how the grid was configured the last time the user looked at it, #2 – apply those preferences to the grid we are currently rendering.

    I’ve been doing this with savestate and loadstate, but this is undesirable because the grid has to exist before you can loadstate, which means the grid shows one thing, then quickly changes to another after we loadstate — applying the user’s filtering, sorting, grouping, column widths and positions, etc. This is a jarring user experience.

    My second thought was to make the grid invisible (put it in a div with display: none) but the grid doesn’t seem to exist until you make it visible. The loadstate is delayed and you still get the visible change after the preferences are loaded.

    My third attempt was to extract the preferences into the initial grid configuration. You can do this for certain things, like setting the width on columns, or the groups. However, you can’t set the sort order or a filter at the time of grid creation, only after the grid has been shown. That’s pretty much the same as using loadstate.

    So, I’m looking for a way to either: (A) create, populate, and loadstate the grid while it’s invisible; or (B) set all options, like filters and sorting, at the time the grid is created. Is there a way to do either of these?

    Thanks!

    Preparing grid before showing it #87345

    Christopher
    Participant

    Hi tvenable.mie,

    You can try to set the visibility style to the jqxGrid to hidden(initialy), while you load the state of the jqxGrid and then after you’ve called the “loadstate” method in the document.ready function, you set it’s visibility back to visible. That way the user won’t see the initial jqxGrid configuration being changed to the saved one. Instead, the user will see only the desired (previously saved) state of the jqxGrid. The display:none style isn’t suitable for this case.

    Best Regards,
    Christopher

    jQWidgets Team
    http://www.jqwidgets.com

    Preparing grid before showing it #87417

    tvenable.mie
    Participant

    Christopher, that totally worked! You’re awesome! You have no idea how much time I’ve spent trying to make this work before. My boss is going to be so happy and I’m going to have a great weekend now. Thank you so much!

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

You must be logged in to reply to this topic.