Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Column order not being restored by ListGrid.setViewState()

    SmartClient Version: SC_SNAPSHOT-2010-12-04/EVAL Deployment

    I am able to successfully save and restore ListGrid settings using getViewState() and setViewState() as well as saving and restoring hiliteState. See this post for details.

    Most aspects of the grid state, such as column widths and sort order, are restored when I call setViewState() and pass it the string I received from getViewState(). But the order of the columns in the grid does not get restored.

    #2
    Appears to be working in the Grid Preferences Sample. Reorder the columns and save the preferences. Then switch between the Default and saved preference to see it take effect.

    Comment


      #3
      I've tested it with some other simpler grids and it is working for me too, just not on the original grid I was working with. That grid has a very large number of columns. There must be something about that specific collection of ListGridFields that could be causing the restore of column order to fail.

      How would I go about debugging that? If I step through with the Eclipse debugger the setViewState() method executes successfully, and as I said, the grid settings do get restored, except for the column order. How can I get more information about what could be going wrong?

      Comment


        #4
        Just trim stuff off (settings and/or columns) until it stops happening.

        Comment


          #5
          I've cut it down to just a few fields and tried setting nothing but the column order and still it doesn't get restored. This is what the ListGrid and it's fields array look like from the dev console. All pretty standard stuff.

          I can see that the settings are getting restored if I change column widths or sort criteria. Just not column order.

          What else can I look for? Is there a debug setting I can change to get more info?
          Code:
          Evaluator: result of 'isc_IpListGrid_0...' (1ms):
          ListGrid{ID: "isc_IpListGrid_0",
          modalEditing: true,
          canAddFormulaFields: true,
          autoFitWidthApproach: "both",
          dataSource: [DataSource ID:ItemSummary],
          autoFetchData: false,
          canEdit: false,
          emptyMessage: "</br></br>Select a category in the merch..."[127],
          emptyMessageStyle: "ipEmptyMessage",
          selectionType: "multiple",
          selectionAppearance: "checkbox",
          height: 745,
          width: 795,
          showGridSummary: true,
          showGroupSummary: true,
          fields: Array[10],
          useAllDataSourceFields: true,
          initialSort: Array[1],
          position: "absolute",
          className: "listGrid",
          top: 31,
          data: Array[0],
          selection: [Selection ID:isc_IpListGrid_0_selection],
          sortFieldNum: 2,
          sortField: "ItemNumber",
          showResizeBar: false,
          parentElement: [VLayout ID:isc_VLayout_7],
          topElement: [VLayout ID:isc_VLayout_3],
          tabIndex: 2020,
          booleanTrueImage: "[SKINIMG]/DynamicForm/checked.png",
          booleanFalseImage: "[SKINIMG]/DynamicForm/unchecked.png",
          booleanPartialImage: "[SKINIMG]/DynamicForm/partialcheck.png",
          booleanImageWidth: 13,
          booleanImageHeight: 13,
          originalFields: Array[10],
          completeFields: Array[19],
          canFreezeFields: true,
          header: [Toolbar ID:isc_Toolbar_3],
          sorter: [ImgButton ID:isc_IpListGrid_0_sorter],
          children: Array[4],
          headers: Array[1],
          body: [GridBody ID:isc_IpListGrid_0_body],
          bodies: Array[1],
          dragScrollTarget: [GridBody ID:isc_IpListGrid_0_body],
          summaryRow:[ListGrid ID:isc_IpListGrid_0_summaryRow],
          peers: Array[1],
          zIndex: 202664,
          cacheOffsetCoords: true,
          innerWidth: 777,
          bodyHeight: 699,
          bodyWidth: 793,
          headerMenuButton: [HeaderImgButton ID:isc_IpListGrid_0_headerMenuButton]}
          
          Evaluator: result of 'isc_IpListGrid_0.fields...' (1ms):
          [Obj{name:_checkboxField}, Obj{name:IPPK}, Obj{name:ItemNumber}, Obj{name:ISKU}, Obj{name:IDES}, Obj{name:IVST}, Obj{name:IRET}, Obj{name:IVLC}, Obj{name:ITIU}, Obj{name:OnOrderInEaches}
          ]

          Comment


            #6
            You could look at the viewstate string you see before and after reorder.

            Comment


              #7
              I can see that the saved viewState string has the fields listed in the correct order by stopping it just prior to calling setViewState(). After calling setViewState() the grid is updated with any other settings in the viewState string (like sort criteria and column widths), just not column order.

              Comment


                #8
                Which browser(s) have you tried this in? Have you tried in it web mode too? Also can you saving the state without the sort criteria (i.e col reordering only) and without a selected record. Then try to restore the state and see if it works. Just trying to narrow down the issue.

                Comment


                  #9
                  Still looking into this but haven't had much time to spend on it. It may still be that my data source has too many fields and the viewState String is too long to be saved in my database, which has a 32k limit for LONG VARCHAR fields.

                  One thing I have noticed is that the viewState string includes every field in the data source, even those that have no useful state information to save. For example, this is repeated for all of the fields that are not selected for display.

                  {\r name:\"HFVI\", \r visible:false, \r width:null\r },

                  I'll probably end up reducing the number of available columns in the grid to get around this. But it seems like the size of the viewState string could be reduced significantly by changing the serialization strategy.

                  Comment


                    #10
                    For testing can you simplify your save state / restore state by saving the string as a variable like the showcase sample? This would eliminate any issue with the string begin changed from the roundtrip to your database.

                    Sanjiv

                    Comment


                      #11
                      I'm looking into this some more and still not able to see where there is a problem with the viewState string being saved and restored. I've captured the string using debug in Eclipse just prior to calling setViewState(). Here is what it looks like. It's quite long, but looks correct. You can see that the order of fields is 1) checkboxField, 2) ItemNumber, 3) IPPK. The default column order is 1) checkbox, 2) IPPK, 3) ItemNumber. But after calling setViewState() with the following string the column order remains unchanged.
                      Code:
                      ({selected:null,field:"[\r    {\r        name:\"_checkboxField\", \r        width:28\r    }, \r    {\r        name:\"ItemNumber\", \r        width:null\r    }, \r    {\r        name:\"IPPK\", \r        width:null\r    }, \r    {\r        name:\"IDES\", \r        width:null\r    }, \r    {\r        name:\"IVST\", \r        width:null\r    }, \r    {\r        name:\"IRET\", \r        width:null\r    }, \r    {\r        name:\"IVNC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVLC\", \r        width:null\r    }, \r    {\r        name:\"ITIR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ITIU\", \r        width:null\r    }, \r    {\r        name:\"ITIC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"OnOrderInEaches\", \r        width:null\r    }, \r    {\r        name:\"OnOrderInPacks\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"OnOrderRetail\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"OnOrderCost\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"DIVNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"DPTNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"SBDNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"CLSNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"VENNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"CLRNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"SIZNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"CGPNAM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"CSRI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBAS\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IZPR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IMKD\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IDIV\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IDPT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISBD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICLS\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVEN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISTY\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICLR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISIZ\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISKU\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISDS\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICGP\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISBN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGTIN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IACC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ILOCC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ILOCF\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ILVC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"INVC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"INCI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IORT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISUG\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPLU\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IALT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ITMP\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ITFI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ITTI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISPR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISPQ\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"minIRET\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI01\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI02\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI03\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI04\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI05\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI06\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI07\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI08\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI09\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRI10\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC01\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC02\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC03\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC04\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC05\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC06\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC07\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC08\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC09\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRC10\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN01\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN02\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN03\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN04\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN05\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN06\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN07\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN08\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN09\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRN10\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ01\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ02\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ03\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ04\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ05\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ06\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ07\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ08\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ09\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPRQ10\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICRV1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICRV2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICRV3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICRV4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IALC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IALC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IALC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IALC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IFDC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IFDC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IFDC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IFDC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPMC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPMC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPMC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPMC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IGMC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPAC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBGU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPUU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVRU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISLU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IAPU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUPU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAU1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAU2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAU3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUAU4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveWeek\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveMonth\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveSeason\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveYear\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveCostWeek\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveCostMonth\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveCostSeason\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ShrinkageReserveCostYear\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPS1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPS2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPS3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPS4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPS5\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPR5\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPI1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPI2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPI3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPI4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPI5\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVSR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVSR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVSR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVSR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVMR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVMR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVMR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVMR4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVIR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVPC1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVPC2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVPC3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVPC4\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISTS\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHLD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVAT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IXDI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ILPI\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IRTN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ILET\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IITR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IUCD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IWT2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IMIN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IMLT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISUQ\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISUD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ITKT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICYC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICOR\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICOM\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICOD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ICCD\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IPPC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IDQT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISQF\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IDDC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVCH\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVCW\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVCL\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVCT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IVCU\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IQCT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ReclassedToItemNumber\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPR1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPR2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPR3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPI1\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPI2\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IHPI3\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBSS\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IGSK\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IS#T\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IMMH\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IWKH\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISRC\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IBIN\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"ISAL\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IMUC\", \r        visible:false, \r        width:null, \r        autoFitWidth:true\r    }, \r    {\r        name:\"IPKT\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IATT01\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IATT02\", \r        visible:false, \r        width:null\r    }, \r    {\r        name:\"IATT03\", \r        visible:false, \r        width:null\r    }\r]",sort:"({\r    fieldName:\"ItemNumber\", \r    sortDir:true, \r    sortSpecifiers:[\r        {\r            property:\"ItemNumber\", \r            direction:\"ascending\"\r        }\r    ]\r})"})
                      Any chance of reducing the size of the string by not including fields that are not visible? Our database has a limit of 32k for LONG VARCHAR fields and we're very close to that limit with this grid. If the user were to add a formula column or two it might be too big to save. I've proposed limiting the number of fields the user can choose from and am getting strong resistance to that idea. I suppose I could look for a different storage strategy but for performance reasons alone it seems like finding a more condensed format for the string would be a good idea.
                      Last edited by jay.l.fisher; 10 Dec 2010, 07:58.

                      Comment


                        #12
                        Just because I don't think it's been covered before - are you calling setViewState after the last calls to setDataSource and setFields? That's required.

                        On the size of the string, we're going to be getting rid of all that whitespace. That's not intendd to be there and is a recent regression.

                        Comment


                          #13
                          Actually no, we've created a sub-class of ListGrid which calls setViewState() in the constructor after retrieving the default settings string from the database for the current user. The class that uses that grid then calls setDataSource() and setFields() after it is constructed.

                          It sounds like that technique isn't going to work. We'll have to have code in each class to restore the default view settings after calling setDataSource() and setFields(). Thanks for pointing that out. I don't suppose that requirement is likely to disappear, is it? It is more convenient to have the constructor take care of restoring the user's default view state. It does seem to work in most cases.

                          Comment


                            #14
                            Glad we finally got to the bottom of that. No, the requirement wouldn't change, because calling setFields() after setViewState() really should impose the specific field order the developer is passing in. But we'll make the required call order more clear in the docs.

                            Comment


                              #15
                              Unfortunately that doesn't seem to have been the issue. I've removed the method that restores the grid settings from the ListGrid constructor. I'm now calling that method after the grid has been constructed and setDataSource(), setFields() and setUseAllDataSourceFields(true) have all been called. Only then do I call setViewState().

                              I've stepped through in debug and added SC.logWarn() messages to be sure of the sequence and the restore of the settings is the last thing that happens, but still the column order is not restored.

                              Comment

                              Working...
                              X