mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-10 10:26:38 +02:00
Started simplying data retrieval APIs
This commit is contained in:
parent
8f8e468278
commit
4f7249bfa4
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tablefilter",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.5",
|
||||
"description": "A Javascript library making HTML tables filterable and a bit more",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
|
|
|
@ -2288,7 +2288,36 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the table data with following format:
|
||||
* Return the table data based on its columns data type definitions
|
||||
* with following structure:
|
||||
* [
|
||||
* [rowIndex, [data0, data1...]],
|
||||
* [rowIndex, [data0, data1...]]
|
||||
* ]
|
||||
* @param {Boolean} [includeHeaders=false] Include headers row
|
||||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @returns {Array}
|
||||
*/
|
||||
getData(includeHeaders = false, excludeHiddenCols = false) {
|
||||
return this.getTableData(includeHeaders, excludeHiddenCols, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the table values with following structure:
|
||||
* [
|
||||
* [rowIndex, [value0, value1...]],
|
||||
* [rowIndex, [value0, value1...]]
|
||||
* ]
|
||||
* @param {Boolean} [includeHeaders=false] Include headers row
|
||||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @returns {Array}
|
||||
*/
|
||||
getValues(includeHeaders = false, excludeHiddenCols = false) {
|
||||
return this.getTableData(includeHeaders, excludeHiddenCols, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the table data with following structure:
|
||||
* [
|
||||
* [rowIndex, [value0, value1...]],
|
||||
* [rowIndex, [value0, value1...]]
|
||||
|
@ -2297,6 +2326,7 @@ export class TableFilter {
|
|||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @param {Boolean} [typed=false] Return typed value
|
||||
* @return {Array}
|
||||
* @private
|
||||
*
|
||||
* TODO: provide an API returning data in JSON format
|
||||
*/
|
||||
|
@ -2333,7 +2363,40 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the filtered data with following format:
|
||||
* Return the filtered table data based on its columns data type definitions
|
||||
* with following structure:
|
||||
* [
|
||||
* [rowIndex, [data0, data1...]],
|
||||
* [rowIndex, [data0, data1...]]
|
||||
* ]
|
||||
* @param {Boolean} [includeHeaders=false] Include headers row
|
||||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @return {Array}
|
||||
*
|
||||
* TODO: provide an API returning data in JSON format
|
||||
*/
|
||||
getFilteredData(includeHeaders = false, excludeHiddenCols = false) {
|
||||
return this.filteredData(includeHeaders, excludeHiddenCols, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filtered table values with following structure:
|
||||
* [
|
||||
* [rowIndex, [value0, value1...]],
|
||||
* [rowIndex, [value0, value1...]]
|
||||
* ]
|
||||
* @param {Boolean} [includeHeaders=false] Include headers row
|
||||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @return {Array}
|
||||
*
|
||||
* TODO: provide an API returning data in JSON format
|
||||
*/
|
||||
getFilteredValues(includeHeaders = false, excludeHiddenCols = false) {
|
||||
return this.filteredData(includeHeaders, excludeHiddenCols, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the filtered data with following structure:
|
||||
* [
|
||||
* [rowIndex, [value0, value1...]],
|
||||
* [rowIndex, [value0, value1...]]
|
||||
|
@ -2342,15 +2405,16 @@ export class TableFilter {
|
|||
* @param {Boolean} [excludeHiddenCols=false] Exclude hidden columns
|
||||
* @param {Boolean} [typed=false] Return typed value
|
||||
* @return {Array}
|
||||
* @private
|
||||
*
|
||||
* TODO: provide an API returning data in JSON format
|
||||
*/
|
||||
getFilteredData(
|
||||
filteredData(
|
||||
includeHeaders = false,
|
||||
excludeHiddenCols = false,
|
||||
typed = false
|
||||
) {
|
||||
if (!this.validRowsIndex) {
|
||||
if (this.validRowsIndex.length === 0) {
|
||||
return [];
|
||||
}
|
||||
let rows = this.tbl.rows,
|
||||
|
@ -2566,7 +2630,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Makes defined rows always visible
|
||||
* Make defined rows always visible
|
||||
*/
|
||||
enforceVisibility() {
|
||||
if (!this.hasVisibleRows) {
|
||||
|
@ -2604,7 +2668,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Clears filtered columns visual indicator (background color)
|
||||
* Clear filtered columns visual indicator (background color)
|
||||
*/
|
||||
clearActiveColumns() {
|
||||
for (let i = 0, len = this.getCellsNb(this.headersRow); i < len; i++) {
|
||||
|
@ -2656,7 +2720,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Builds filter element ID for a given column index
|
||||
* Build filter element ID for a given column index
|
||||
* @param {any} colIndex
|
||||
* @returns {String} Filter element ID string
|
||||
* @private
|
||||
|
@ -2727,7 +2791,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Determines if passed filter column implements exact query match
|
||||
* Determine if passed filter column implements exact query match
|
||||
* @param {Number} colIndex Column index
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
@ -2738,7 +2802,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if passed row is valid
|
||||
* Check if passed row is valid
|
||||
* @param {Number} rowIndex Row index
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
@ -2747,7 +2811,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if passed row is visible
|
||||
* Check if passed row is visible
|
||||
* @param {Number} rowIndex Row index
|
||||
* @returns {Boolean}
|
||||
*/
|
||||
|
@ -2757,7 +2821,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if specified column filter ignores diacritics.
|
||||
* Check if specified column filter ignores diacritics.
|
||||
* Note this is only applicable to input filter types.
|
||||
* @param {Number} colIndex Column index
|
||||
* @returns {Boolean}
|
||||
|
@ -2771,7 +2835,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns clear all text for specified filter column
|
||||
* Return clear all text for specified filter column
|
||||
* @param {Number} colIndex Column index
|
||||
* @returns {String}
|
||||
*/
|
||||
|
@ -2860,7 +2924,7 @@ export class TableFilter {
|
|||
|
||||
/**
|
||||
* Get list of filter IDs
|
||||
* @return {[type]} [description]
|
||||
* @return {Array} List of filters ids
|
||||
*/
|
||||
getFiltersId() {
|
||||
return this.fltIds || [];
|
||||
|
|
Loading…
Reference in a new issue