Announcement

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

    Getting ListGrid fields before grid is drawn

    I have a ListGrid that gets it's fields from a datasource. I need to add some features to selected fields such as summary functions before the grid is first drawn. Prior to release 2.1 I had code that used ListGrid.getOrCreateJsObj() and then was able to get the list of fields and apply the additional features. After installing 2.1 this code no longer works. I now have to call ListGrid.draw before I can get the list of fields. What is the correct way to get the ListGridFields and do things to them before the grid is drawn?

    I know I can add the specific fields I need to the grid and then setUseAllDataSourceFields(true) but that causes the fields I have explicitly set to come first, when what I want is the fields to the in the order they are specified in the datasource, just with my additional features added.

    #2
    I realize now that I can iterate over the list of field names from the datasource, create a ListGridField from each, override whatever I need to override and add them to the ListGrid without the need to draw() or getOrCreateJsObj().

    Comment


      #3
      At least with native SC you can call lg.setFields(lg.fields) to force their initialization before the grid is drawn. Otherwise they are lazily initialized when drawn. Then you can spin through them an perform updates as desired.

      Comment

      Working...
      X