var VnObject = require ('./object'); var ModelIface = require ('./model-iface'); var ModelProxy = require ('./model-proxy'); var Mode = ModelProxy.Mode; /** * Model that holds an array of Javascript objects with * the same structure. */ module.exports = new Class ({ Extends: VnObject ,Implements: ModelIface ,Tag: 'vn-json-model' ,Properties: { numRows: { type: Number }, status: { type: Number }, mode: { enumType: Mode ,value: Mode.ON_CHANGE }, data: { type: Array ,set: function (x) { this.data = x; } ,get: function () { return this.data; } } } ,checkColExists: function () {} ,checkRowExists: function () {} ,getColumnIndex: function () {} ,get: function (rowIndex, columnName) { return this.data[rowIndex][columnName]; } ,getByIndex: function (rowIndex, column) { var columnName = this.columns[column]; return this.data[rowIndex][columnName]; } ,getObject: function (rowIndex) { return this.data[rowIndex]; } ,sortByName: function () {} ,sort: function () {} ,search: function () {} ,searchByIndex: function () {} ,set: function () {} ,setByIndex: function () {} ,deleteRow: function () {} ,insertRow: function () {} ,clean: function () {} ,performOperations: function () {} ,indexColumn: function () {} });