Announcement

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

    getGridSummary is not called if not all records are loaded

    Hi,

    I have a long databound ListGrid with paging.
    There is a column for which I would like to show summary which is a dynamic value but not coming from any other DataSource.
    Method getGridSummary is called only if all records are loaded, so I can't show that value before.

    Here is an example. Summary of column area is shown only after you scroll to the bottom despite result of getGridSummary is not related to those records.
    What is the suggested way to show number 7 from the beginning?

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:224, alternateRecordStyles:true,
        dataSource: worldDS,
        // display a subset of fields from the datasource
    showGridSummary: true,
        fields:[
            {name:"countryCode"},
            {name:"countryName"},
            {name:"capital"},
            {name:"continent"},
            {name: "area",
    
    
    showGridSummary: true,
    getGridSummary: function() {
    return 7;
    }
    
    
    }
        ],
        sortField: 1, // sort by countryName
        dataPageSize: 50,
        autoFetchData: true
    })
    
    
    isc.IButton.create({
        left:0, top:240, width:150,
        title:"Filter Country: united",
        click:"countryList.filterData({countryName:'United'})"
    })
    
    
    isc.IButton.create({
        left:170, top:240, width:150,
        title:"Filter Capital: port",
        click:"countryList.filterData({capital:'port'})"
    })
    
    
    isc.IButton.create({
        left:340, top:240, width:150,
        title:"Clear filter",
        click:"countryList.clearCriteria()"
    })
    Best regards,
    Janusz

    #2
    That's documented behavior we describe in ListGrid.getGridSummaru(). If the all data isn't loaded, we return null for every field and the field-lavel.getGridSummary() isn't called. You'll need to override the ListGrid-level method as the docs say:

    This method may be overridden to completely customize the summary value displayed for columns in this grid. An example use case would be when summary information is available on the client and does not need to be calculated directly from the data.

    Comment


      #3
      Thanks. I have forget about it obviously, as I found I have used ListGrid.getGridSummary in some other place.

      I have created my own ListGrid.getGridSummary that should return fixed values for some fields and fall back to original implementation for other fields. It stopped working when I have removed unused getGridSummary functions from fields.
      It appears that ListGridField.getGridSummary needs to be defined (it can be an empty function) for every field that ListGrid calls getGridSummary for. Setting ListGridField.showGridSummary is not enough.
      I think that's different from the implementation explained in doc for ListGrid.getGridSummary.

      Comment

      Working...
      X