Announcement

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

  • ListGrid.refreshData doesn't trigger dataChanged

    SmartClient Version: SNAPSHOT_v12.1d_2019-03-27/AllModules Development Only (built 2019-03-27)
    and
    SmartClient Version: v11.1p_2019-03-27/AllModules Development Only (built 2019-03-27)

    Hello, I've just noticed that ListGrid.refreshData doesn't trigger dataChanged, you may try this modified sample (id=gridComponents):

    Code:
    isc.ToolStrip.create({
        ID: "gridEditControls",
        width: "100%", height:24, 
        members: [
            isc.Label.create({
                padding:5,
                ID:"totalsLabel"
            }),
            isc.LayoutSpacer.create({ width:"*" }),
            isc.ToolStripButton.create({
                title:"Refresh Data",
                click: "countryList.refreshData()"
            })
        ]
    });
    
    isc.ListGrid.create({
        ID: "countryList",
        width:500, height:425, alternateRecordStyles:true,
        dataSource: countryDS,
        fields:[
            {name:"countryCode", title:"Code", width:50},
            {name:"countryName", title:"Country"},
            {name:"capital", title:"Capital"},
            {name:"continent", title:"Continent"}
        ],
        autoFetchData: true,
        showFilterEditor: true,
        canEdit:true,
        editEvent:"none",
        gridComponents:["header", "filterEditor", "body", gridEditControls],
        dataChanged : function () {
            isc.logEcho('dataChanged')
            this.Super("dataChanged", arguments);
            var totalRows = this.data.getLength();
            if (totalRows > 0 && this.data.lengthIsKnown()) {
                totalsLabel.setContents(totalRows + " Records");
            } else {
                totalsLabel.setContents(" ");
            }
        }
    })
    If you press 'refresh data' you'll see that 'dataChanged' isn't logged.

    Is it by design? Reading the dataChanged docs it seems that it would be called even in this case.

  • #2
    Yes, this is by design. You can use the callback of refreshData if you want a notification.

    Comment


    • #3
      Thanks, maybe a note in the documentation which specifies that in the case of refreshData it isn't called, would be useful, as a simple implementation like that sample taken from the showcase (which I've used extensively in my applications) seems broken if one uses refreshData.

      Comment


      • #4
        We've added a note about dataChanged() not being called to the docs for refreshData() back to SC 11.1p. It should be picked up by the next nightly builds.

        Comment

        Working...
        X