Search code examples
javascriptrecordset

recline js recordCount doesn't update


Start with this:

var arr = [{a : 1}, {b : 2}, {b : 2}, {b : 2}]

var dataset = new recline.Model.Dataset({
                  records: arr
                  });

dataset.recordCount // returns 4

dataset.records.reset() //all records are gone

but dataset.recordCount is still 4


Solution

  • Remember that the records attribute on a Dataset just represents a partial "window" of records from the full set of records stored in the associated backend.

    Changing records will have no affect on the backend unless you save and requery.

    Remember: recordCount is total number of records in the backend not the total in the .records list.