new ludo.dataSource.Record()
Class representing a record in a Collection
Instances of this class are created by the collections getRecord method.
When you update a record
- Source:
Methods
-
get(key) → {String|Number|Object}
-
Return value of key
Parameters:
Name Type Description key
String - Source:
Returns:
value
- Type
- String | Number | Object
-
set(key, value) → {dataSource.Record}
-
Update property of record
Parameters:
Name Type Description key
String value
String | Number | Object - Source:
Returns:
- Type
- dataSource.Record
-
setProperties(properties) → {dataSource.Record|undefined}
-
Update multiple properties
Parameters:
Name Type Description properties
Object - Source:
Returns:
- Type
- dataSource.Record | undefined
Examples
var collection = new ludo.dataSource.JSONArray({ idField:'id' }); collection.getRecord(100).setProperties({ country:'Norway', capital:'Oslo' }); will set country to "Norway" and capital to "Oslo" for record where "id" is equal to 100. If you're not sure that the record exists, you should use code like this:
var rec = collection.getRecord(100); if(rec)rec.setProperties({ country:'Norway', capital:'Oslo' });