1. #1
    Ext User
    Join Date
    Mar 2008
    Posts
    89
    Vote Rating
    0
    Shaguar is on a distinguished road

      0  

    Default Save the column model changes

    Save the column model changes


    Hello,
    i try to make it as short as possible.
    1. Is it possible to save the column model in a xml file or mysql database so i can change the width or reorder the columns and then automatically store it somewhere and the next time i visit my grid it restores the old status
    (even how many records are set per page and which page is currently shown)
    I got more problems like this but let's first clear up this question.

    Thanks a lot.

  2. #2
    Sencha User
    Join Date
    Jan 2008
    Posts
    240
    Vote Rating
    0
    OutpostMM is on a distinguished road

      0  

    Default


    It would be easy enough to set up a custom object, just an object with all of the properties you want to save, and send that to a PHP page, encode it to JSON, and store it in a database. When the page loads PHP could get the JSON text out of the database, send it to Ext, and then you can use Ext.apply to apply all of the properties in the stored object to the component on the page.

  3. #3
    Sencha User catacaustic's Avatar
    Join Date
    Jul 2007
    Location
    "A Land Down Under"
    Posts
    618
    Vote Rating
    1
    catacaustic is on a distinguished road

      0  

    Default


    This is possible. I've done it using JSON. You need to keep track of the ColumnModel's events, and save the details on those. If you want to track them all, set an external function that will do it and call it each time any of the events fire.

    You can loop through each column and get the details (getDataIndex (), isHidden (), etc) and save those to whatever format you want it.
    'Once again, fortune vomits on my eiderdown'
    - Edmund Blackadder

  4. #4
    Ext User
    Join Date
    Mar 2008
    Posts
    89
    Vote Rating
    0
    Shaguar is on a distinguished road

      0  

    Default


    Ok i call a function every time any of these events fire :
    columnmoved, hiddenchange, widthchange, configchanged
    then i read i read the current width with getColumnWidth etc,
    but where do i get the current page and entries per page frrom? (and how do u set them)

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    Much of this is already done by the state manager.

    ps. Search the extension forum for a provider that can load/save the state from/to the server.

  6. #6
    Ext User
    Join Date
    Mar 2008
    Posts
    89
    Vote Rating
    0
    Shaguar is on a distinguished road

      0  

    Default


    ok, with
    var stateProvider = new Ext.state.CookieProvider();
    Ext.state.Manager.setProvider(stateProvider);
    i initialze the state manager, but how do i save/load the grid / columnModel preferences?
    Do i have to write it all by myself with those set and get functions provided by the state.Manager or stateProvider ?
    example :
    PHP Code:
    function savePref()
    {
      
    stateProvider.set('ColumnOneWidth',ColumnModel.getColumnWidth(0));
      
    stateProvider.set('ColumnTwoWidth',ColumnModel.getColumnWidth(1));
    ...
    ...
    }

    function 
    loadPref()
    {
      
    ColumnModel.setColumnWidth(0stateProvider.get('ColumnOneWidth'));
    ...
    ...

    or is there an easier way to do it?
    Because this would be very inconvenient.
    again, how can i read the pagingToolbar attributes?
    (I cant find a good (working) example for this kind of stuff)

  7. #7
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    89
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    1. Column width and visibility are already stored by the state manager.
    2. There are several people working on saving/loading grid state (search the forum).

  8. #8
    Ext User
    Join Date
    Mar 2008
    Posts
    89
    Vote Rating
    0
    Shaguar is on a distinguished road

      0  

    Default


    Ok i've searched the forum but i didnt find anything, i'm sorry.
    I found something but nothing what could help me in this case.

  9. #9
    Ext User
    Join Date
    Mar 2008
    Posts
    24
    Vote Rating
    0
    vk214 is on a distinguished road

      0  

    Default


    I'm trying to do something similar - save/load the grid state settings to/from server. I found this post from last year, but it doesn't seem to make use of the StateManager. Not sure if there is a different way to do this with the new API? Check out this post

  10. #10
    Ext User
    Join Date
    Jul 2007
    Posts
    3,128
    Vote Rating
    1
    devnull is an unknown quantity at this point

      0  

    Default


    just by having a working state manager intialized, my grids have saved column order, column width, and store sorting info with no other changes required.
    make sure that the state provider is initialized before any of the grids are though or the grids wont know how to save their states.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi