[CLOSED] Column order on grid panel store reorder?

  1. #1

    [CLOSED] Column order on grid panel store reorder?

    Hi

    I have a grid with

    1. ColA
    2. ColB

    The user can then reorder these column to

    1. ColB
    2. ColA

    This is great, I then use getRowsValues to pass the grid back to the server however the order of the column is ColA - ColB and not ColB - ColA.
    Is there anyway to get getRowsValues to pass back in the new order?

    Thanks,
    Dan
    Last edited by Daniil; Jul 03, 2015 at 8:16 AM. Reason: [CLOSED]
  2. #2
    Hi @CanopiusApplications,

    Yes, .getRowsValues() doesn't reflect the columns' order and there is no option in API to reflect it.

    You can manually change the object returned by
    .getRowsValues()
    call according to the columns order.

    Though, I am not sure why you need that. Could you, please, clarify? Do you reflect the data on server by index? If so, I would recommend to reflect the data by a Column's DataIndex (i.e. ModelField's Name).
  3. #3
    Hi Daniil

    Ok the situation is I have 2 grids which are dynamically generated so lets say
    GridA - has columns 1 thru 10.
    GridB - has columns A thru M

    The user can then drag columns in either grid to change the column order. Once they are happy with the order they click a button which posts both grids back to the server where it generates a 3rd grid which amalgamates the columns (based on the new order) and adds calculates the difference so it might look something like

    Parent Col1 - 2
    - B
    - Difference between the column values

    Parent Col2 - 1
    - A
    - Difference between the column values

    Basically just comparing 2 grids and amalgamating into a 3rd after they have dragged the various columns around into the order they want.

    What I have done is posted but state and rowvalues back to the server and manipulated from there which works well enough.

    
     <%--YOU COULD DO THIS IN A CALLBACK AND PLACE THE EXPAND ON SUCCESS -- WOULD PROBABLY BE BETTER--%>
    <Click Handler="Ext.net.Mask.show({ msg: 'Building Comparison....' }); #{gpRMSDiff}.expand(); Daan.direct.ctlCatResults.CompareRMS(Ext.encode(#{gpRMSPrevious}.getState().columns), Ext.encode(#{gpRMSCurrent}.getState().columns), Ext.encode(#{gpRMSPrevious}.getRowsValues({ selectedOnly: false })), Ext.encode(#{gpRMSCurrent}.getRowsValues({ selectedOnly: false })));"></Click>
    The attached image explains it better.
    Click image for larger version. 

Name:	Example.jpg 
Views:	60 
Size:	100.4 KB 
ID:	24046

    So unless you can see a simpler way of posting both the state and values back into a single object I will just go with this.

    Ta,
    D
  4. #4
    Yes, sending the columns order is a good solution and .getState().columns is also good for that.

Similar Threads

  1. [FIXED] [2.2] GridPanel - Column reorder
    By Viktor Reiser in forum Bugs
    Replies: 2
    Last Post: Jan 08, 2013, 7:52 PM
  2. Disable column reorder in gridpanel
    By nuno_Santos in forum 1.x Help
    Replies: 2
    Last Post: May 07, 2012, 3:58 PM
  3. Replies: 1
    Last Post: Jul 27, 2011, 10:19 AM
  4. [CLOSED] [1.0] Column reorder
    By state in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 25, 2010, 7:08 PM
  5. [CLOSED] How to change column order in the grid.
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 15, 2009, 4:48 AM

Posting Permissions