Announcement

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

    ResultSet.dataChanged() not notified for data changes

    I have a ResultSet and I'd like to be notified about data changes triggered by the underlying data source and reflected (among others) into that resultset.

    At event handler to the cache changes thread you suggested
    to create a ResultSet that is provided empty initialData, and implement a DataChanged event handler.
    in order to be notified of cache changes.

    So I've tried using a ResultSet with emtpy initialData, but changes are not notified through DataChanged event handler.
    This is fully reproducible using the current SmartClient showcase Grid Data bound update, simply adding a secondary grid showing contents from an empty resultset which is configured to use the same datasource as the primary grid.
    When you modify the continent for a record on the original grid, that record is added to the second grid, but the dataarrived function is not called at all.

    Follows a snippet to be added to the existing databoundUpdate.js code in order to reproduce the issue

    Code:
    ...
    isc.ResultSet.create ({
        ID: "countryResultSet",
        dataSource: worldDS,
        initialData: [],
        dataArrived: function (startRow, endRow) {isc.say ("data arrived: "+startRow+","+ endRow);}
    })
    
    isc.ListGrid.create({
        ID: "countryList2",
        left: 600, width:500, height:224, alternateRecordStyles:true,
        data: countryResultSet,
        // display a subset of fields from the datasource
        fields:[
            {name:"countryCode"},
            {name:"countryName"},
            {name:"capital"},
            {name:"continent"}
        ],
        sortFieldNum: 0, // sort by countryCode
        dataPageSize: 50,
    //    autoFetchData: true,
        selectionType: "single"
    })
    Last edited by d.cavestro; 3 Jul 2014, 05:09.

    #2
    The event is dataChanged, not dataArrived.

    Comment


      #3
      You are right: I originally thought you meant dataArrived cause the dataChanged documentation says
      Note that this will only fire when items are added, removed or rearranged. If a list contains objects, this method will not fire if changes are made to objects within the list without changing their position within the list
      but I've seen even the update of an already cached record triggers this handler, so that's fine for me now.

      Many thanks for the promptness!

      Comment

      Working...
      X