forked from verdnatura/hedera-web
127 lines
2.7 KiB
JavaScript
127 lines
2.7 KiB
JavaScript
|
|
/**
|
|
* Readable data model.
|
|
*/
|
|
module.exports = new Class({
|
|
Properties: {
|
|
/**
|
|
* The number of rows in the model.
|
|
*/
|
|
numRows: {
|
|
type: Number
|
|
},
|
|
/**
|
|
* The current status of the model.
|
|
*/
|
|
status: {
|
|
type: Number
|
|
},
|
|
/**
|
|
* Checks if the model data is ready.
|
|
*/
|
|
ready: {
|
|
type: Boolean
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Checks if the column exists.
|
|
*
|
|
* @param {integer} column The column index
|
|
* @return {boolean} %true if column exists, %false otherwise
|
|
*/
|
|
,checkColExists() {}
|
|
|
|
/**
|
|
* Checks if the row exists.
|
|
*
|
|
* @param {integer} rowIndex The row index
|
|
* @return {boolean} %true if row exists, %false otherwise
|
|
*/
|
|
,checkRowExists() {}
|
|
|
|
/**
|
|
* Get the index of the column from its name.
|
|
*
|
|
* @param {string} columnName The column name
|
|
* @return {number} The column index or -1 if column not exists
|
|
*/
|
|
,getColumnIndex() {}
|
|
|
|
/**
|
|
* Gets a value from the model.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
* @param {string} columnName The column name
|
|
* @return {*} The value, or %undefined
|
|
*/
|
|
,get() {}
|
|
|
|
/**
|
|
* Gets a value using the column index.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
* @param {number} column The column index
|
|
* @return {*} The value
|
|
*/
|
|
,getByIndex() {}
|
|
|
|
/**
|
|
* Gets a row as an object using the column index.
|
|
*
|
|
* @param {number} rowIndex The row index
|
|
* @return {Object} The row as an object
|
|
*/
|
|
,getObject() {}
|
|
|
|
/**
|
|
* Orders the model by the specified column name.
|
|
*
|
|
* @param {number} column The column name
|
|
* @param {SortWay} way The sort way
|
|
*/
|
|
,sortByName() {}
|
|
|
|
/**
|
|
* Orders the model by the specified column.
|
|
*
|
|
* @param {number} column The column index
|
|
* @param {SortWay} way The sort way
|
|
*/
|
|
,sort() {}
|
|
|
|
/**
|
|
* Searchs a value on the model and returns the row index of the first
|
|
* ocurrence.
|
|
* If an index have been built on that column, it will be used, for more
|
|
* information see the indexColumn() method.
|
|
*
|
|
* @param {string} column The column name
|
|
* @param {Object} value The value to search
|
|
* @return {number} The column index
|
|
*/
|
|
,search() {}
|
|
|
|
/**
|
|
* Searchs a value on the model and returns the row index of the first
|
|
* ocurrence.
|
|
*
|
|
* @param {number} col The column index
|
|
* @param {Object} value The value to search
|
|
* @return {number} The column index
|
|
*/
|
|
,searchByIndex() {}
|
|
|
|
/**
|
|
* Builds an internal hash index for the specified column, this speeds
|
|
* significantly searches on that column, specially when model has a lot of
|
|
* rows.
|
|
*
|
|
* FIXME: Not fully implemented.
|
|
*
|
|
* @param {string} column The column name
|
|
*/
|
|
,indexColumn() {}
|
|
});
|
|
|
|
|