1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-01 13:32:40 +02:00

Updated 2.2 Public methods (markdown)

koalyptus 2016-05-08 16:29:00 +10:00
parent 2c149f642e
commit 2c71048c02

@ -1,303 +1,2 @@
<table>
<thead>
<tr>
<th>Method</th>
<th>Description</th>
<th>Remarks</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<th>init()</th>
<td>initialise the filters according to configuration properties</td>
<td></td>
<td><code>var myTF = new TableFilter('tableId');<br>
myTF.paging = true;<br />
... <br />
myTF.init();</code></td>
</tr>
<tr>
<th>destroy()</th>
<td>Destroy the filters</td>
<td>the <code>TableFilter</code> instance is still available and can be re-initialised with the <code>init</code> method</td>
<td><code>myTF.destroy();</code></td>
</tr>
<tr>
<th>filter()</th>
<td>filters the table columns</td>
<td></td>
<td><code>myTF.filter();</code></td>
</tr>
<tr>
<th>clearFilters()</th>
<td>clear the column filters</td>
<td></td>
<td><code>myTF.clearFilters();</code></td>
</tr>
<tr>
<th>clearActiveColumns()</th>
<td>clear the active column headers</td>
<td></td>
<td><code>myTF.clearActiveColumns();</code></td>
</tr>
<tr>
<th>hasGrid()</th>
<td>check if the table filters are instantiated</td>
<td></td>
<td><code>myTF.hasGrid();</code></td>
</tr>
<tr>
<th>feature(name)</th>
<td>retrieve a feature instance from the features registry
<ul>
<li>name: feature name (ie 'gridLayout')</li>
</ul>
</td>
<td></td>
<td><code>myTF.feature('gridLayout');</code></td>
</tr>
<tr>
<th>extension(name)</th>
<td>retrieve an extension instance from the extensions registry
<ul>
<li>name: extension name (ie 'colsVisibility')</li>
</ul>
</td>
<td></td>
<td><code>myTF.extension('colsVisibility');</code></td>
</tr>
<tr>
<th>getFilterId(index)</th>
<td><p>return the filter id of the specified column:</p>
<ul>
<li>index: column index (numeric value)</li>
</ul></td>
<td>note that hidden filters are also returned</td>
<td><code>myTF.getFilterId(1);</code></td>
</tr>
<tr>
<th>getFiltersId()</th>
<td>return an array containing the filters' ids</td>
<td>note that hidden filters are also returned</td>
<td><code>myTF.getFiltersId();</code></td>
</tr>
<tr>
<th>getFilterValue(index)</th>
<td><p>retrieve the value of a specified filter:</p>
<ul>
<li>index: filter column index (number)</li>
</ul></td>
<td>note that the index of the first filter is <strong>0</strong></th>
<td><code>myTF.getFilterValue(5);</code></td>
</tr>
<tr>
<th>getFiltersByType(type, bool)</th>
<td><p>return an array of filter ids for a specified filter type
('input', 'selects' etc.):</p>
<ul>
<li>type: filter type string (&quot;input&quot;, &quot;select&quot;,
&quot;multiple&quot;, &quot;checklist&quot;)</li>
<li>optional boolean: if set true it returns column indexes
instead of the filter ids</li>
</ul></td>
<td></td>
<td><code>myTF.getFiltersByType('select', true);</code></td>
</tr>
<tr>
<th>getFiltersValue()</th>
<td>return an array of the value of each column filter</td>
<td></td>
<td><code>myTF.getFiltersValue();</code></td>
</tr>
<tr>
<th>getFilterElement(index)</th>
<td><p>return the filter DOM element for a given column index</p>
<ul>
<li>index: filter column index (number)</li>
</ul></td>
<td></td>
<td><code>var fltElm = myTF.getFilterElement(2);</code></td>
</tr>
<tr>
<th>getHeaderElement(index)</th>
<td><p>return the column header DOM element for a given column index</p>
<ul>
<li>index: header column index (number)</li>
</ul></td>
<td></td>
<td><code>var headElm = myTF.getHeaderElement(1);</code></td>
</tr>
<tr>
<th>setFilterValue(index, searcharg)</th>
<td><p>set the value of a specified filter:</p>
<ul>
<li>index: filter column index (number)</li>
<li>searcharg: search string</li>
</ul></td>
<td></td>
<td><code>myTF.setFilterValue(1, 'my search string');</code></td>
</tr>
<tr>
<th>getColValues(colIndex, includeHeaders, num, exclude)</th>
<td><p>return the data of a specified colum:</p>
<ul>
<li>colIndex: column index (number)</li>
<li>includeHeaders (optional): if set true the column's header text is included in
returned array (boolean)</li>
<li>num (optional): a boolean set to true if we want only numbers to be returned (used for column calculations) - deafult false</li>
<li>exclude (optional): array containing rows indexes to be excluded
from returned values</li>
</ul></td>
<td></td>
<td><code>myTF.getColValues(2, false);</code></td>
</tr>
<tr>
<th>getValidRows(reCalc)</th>
<td>return an array containing valid rows indexes (rows visible upon
filtering) Param:
<ul>
<li>reCalc: if set true the valid rows indexes are re-calculated (boolean)</li>
</ul>
</td>
<td></td>
<td><code>myTF.getValidRowsIndex();</code></td>
</tr>
<tr>
<th>getStartRowIndex()</th>
<td>return the index of the row from which will start the filtering
process</td>
<td></td>
<td><code>myTF.getStartRowIndex();</code></td>
</tr>
<tr>
<th>getLastRowIndex()</th>
<td>return the index of the last row</td>
<td></td>
<td><code>myTF.getLastRowIndex();</code></td>
</tr>
<tr>
<th>getFiltersRowIndex()</th>
<td>return the index of the row containing the filters</td>
<td></td>
<td><code>myTF.getFiltersRowIndex();</code></td>
</tr>
<tr>
<th>getHeadersRowIndex()</th>
<td>return the index of the headers' row</td>
<td></td>
<td><code>myTF.getHeadersRowIndex();</code></td>
</tr>
<tr>
<th>getTableData(includeHeaders, excludeHiddenCols)</th>
<td><p>return an array containing all the data, optionally from only the visible columns (hidden using the colsVisibility extension). The
returned array is formated in the following manner: </p>
<pre>
[
[rowIndex, [value0, value1...]],
[rowIndex, [value0, value1...]]
]
</pre>
Param:
<ul>
<li>includeHeaders (optional): if set true header captions are included in
returned array (boolean)</li>
<li>excludeHiddenCols (optional): if set true hidden columns are excluded from the
returned array (boolean)</li>
</ul>
</td>
<td></td>
<td><code>myTF.getTableData();</code></td>
</tr>
<tr>
<th>getFilteredData(includeHeaders, excludeHiddenCols)</th>
<td><p>return an array containing only the filtered data, optionally from only the visible columns (hidden using the colsVisibility extension). The returned array is formated in the following manner: </p>
<pre>
[
[rowIndex, [value0, value1...]],
[rowIndex, [value0, value1...]]
]
</pre>
Param:
<ul>
<li>includeHeaders (optional): if set true header captions are included in
returned array (boolean)</li>
<li>excludeHiddenCols (optional): if set true hidden columns are excluded from the
returned array (boolean)</li>
</ul></td>
<td></td>
<td><code>myTF.getFilteredData();</code></td>
</tr>
<tr>
<th>getFilteredDataCol(colIndex, includeHeaders)</th>
<td><p>return an array containing the filtered data of a
specified column. The returned array is formatted in the following
manner: </p>
<pre>
[
[rowIndex, [value0, value1...]],
[rowIndex, [value0, value1...]]
]
</pre>
Param:
<ul>
<li>includeHeaders (optional): if set true the column's header text is included in
returned array (boolean)</li>
</ul>
</td>
<td></td>
<td><code>var a = myTF.getFilteredDataCol(3);</code></td>
</tr>
<tr>
<th>getCellData(cell)</th>
<td><p>Return the data (string) of a given cell</p>
<ul>
<li>cell: Cell DOM element(DOMElement)</li>
</ul></td>
<td></td>
<td><code>var cellText = myTF.getCellData(myCell);</code></td>
</tr>
<tr>
<th>getCellsNb(nrow)</th>
<td>return number of cells of a specified row</td>
<td></td>
<td><code>myTF.getCellsNb(1);</code></td>
</tr>
<tr>
<th>getRowsNb(includeHeaders)</th>
<td><p>return the total number of filterable rows starting from reference row if defined</p>
Param:
<ul>
<li>includeHeaders: if set true the headers row(s) is also included (boolean)</li>
</ul>
</td>
<td></td>
<td><code>myTF.getRowsNb();</code></td>
</tr>
<tr>
<th>config()</th>
<td>return the configuration object</td>
<td></td>
<td><code>var config = myTF.config();</code></td>
</tr>
<tr>
<th>getFilterableRowsNb()</th>
<td>return the total number of rows that can be filtered</td>
<td></td>
<td><code>var nbFilterableRows = myTF.getFilterableRowsNb();</code></td>
</tr>
<tr>
<th>getHeadersText(excludeHiddenCols)</th>
<td>
<p>return an array containing the header's text of each column</p>
Param:
<ul>
<li>excludeHiddenCols (optional): if set true hidden columns are excluded from the
returned array (boolean)</li>
</ul>
</td>
<td></td>
<td><code>var headers = myTF.getHeadersText();</code></td>
</tr>
</tbody>
</table>
Refer to the auto-generated documentation:
[TableFilter class](http://koalyptus.github.io/TableFilter/docs/class/src/tablefilter.js~TableFilter.html)