Import Statement: | import . |
JsonListModel is a syncable list model. It could be used as a wrapper of other Javascript array object. Whatever the source is updated, it will trigger synchronization automatically. It will emit signals of insertion, removal and moving automatically.
Define the available fields of this model. If it is not assigned, JsonListModel will use the first appended record. Then you are not able to change afterward.
Example:
JsonListModel { keyField: "id" fields: [ "id", "value" ] }
Set the key field of data source. The value in key field should be unique.
If it is not set, JsonListModel won't be able to identify insertion, removal and moving changes.
JsonListModel is a wrapper of another Javascript array. Update this property will trigger the synchronization and emit changes according to the difference.
Example:
JsonListModel { keyField: "id" source: [ { "id": "a", "value": 1}, { "id": "b", "value": 2} ] fields: [ "id", "value" ] }
Get the index of the given record which is equal to input value on given field.
If it is not found, it will return -1.
Deletes the content at index from the model. You may specific the no. of items to be removed by count argument.
Changes the item at index in the list model with the values in changes. Properties not appearing in changes are left unchanged.
If index is equal to count() then a new item is appended to the list. Otherwise, index must be an element in the list.
Apply the changes to a record at index. Only modified value will be set.