[#174,refactor][s]: rename currentRecords to records on Dataset.
This commit is contained in:
@@ -6,13 +6,13 @@ var $el = $('.ex-1');
|
||||
function display(dataset) {
|
||||
// total number of records resulting from latest query
|
||||
$el.append('Total found: ' + dataset.recordCount + '<br />');
|
||||
$el.append('Total returned: ' + dataset.currentRecords.length);
|
||||
$el.append('Total returned: ' + dataset.records.length);
|
||||
|
||||
$el.append('<hr />');
|
||||
|
||||
// dataset.currentRecords is a Backbone Collection of Records that resulted from latest query (hence "current")
|
||||
// dataset.records is a Backbone Collection of Records that resulted from latest query (hence "current")
|
||||
// Get the first record in the list - it returns an instance of the Record object
|
||||
var record = dataset.currentRecords.at(0);
|
||||
var record = dataset.records.at(0);
|
||||
|
||||
// Use the summary helper method which produces proper html
|
||||
// You could also do record.toJSON() to get a hash of the record data
|
||||
|
||||
@@ -9,10 +9,10 @@ var $el = $('.ex-2');
|
||||
// On completion the display function will be called
|
||||
dataset.query({q: 'UK', size: 2}).done(function() {
|
||||
$('.ex-2').append('Total found: ' + dataset.recordCount);
|
||||
$('.ex-2').append(' Total returned: ' + dataset.currentRecords.length);
|
||||
$('.ex-2').append(' Total returned: ' + dataset.records.length);
|
||||
$('.ex-2').append(
|
||||
$('<pre />').html(
|
||||
JSON.stringify(dataset.currentRecords.toJSON(), null, 2)
|
||||
JSON.stringify(dataset.records.toJSON(), null, 2)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ function onChange() {
|
||||
$('.ex-events').append('<br />');
|
||||
}
|
||||
|
||||
dataset.currentRecords.bind('reset', onChange);
|
||||
dataset.records.bind('reset', onChange);
|
||||
|
||||
dataset.query({q: 'DE'});
|
||||
dataset.query({q: 'UK'});
|
||||
|
||||
@@ -5,6 +5,6 @@ dataset.fields.models[6] = new recline.Model.Field({
|
||||
label: 'Location',
|
||||
type: 'geo_point'
|
||||
});
|
||||
var rec = dataset.currentRecords.at(0);
|
||||
var rec = dataset.records.at(0);
|
||||
$el.append(dataset.recordSummary(rec));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user