mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-07 16:32:39 +02:00
Updated 3.2 Column operations (markdown)
parent
2c0b71b3eb
commit
9be1351926
|
@ -1,7 +1,10 @@
|
|||
<p>This extension allows <code>TableFilter</code> to perform calculations on a per column basis. Those are the operations that are currently possible:
|
||||
<ul>
|
||||
<li>sum</li>
|
||||
<li>mean</li>
|
||||
<li>median</li>
|
||||
<li>min</li>
|
||||
<li>max</li>
|
||||
<li>lower quartile</li>
|
||||
<li>upper quartile</li>
|
||||
</ul>
|
||||
|
@ -206,3 +209,64 @@ var tfConfig = {
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
Assuming <code>TableFilter</code> is already instanciated:
|
||||
</p>
|
||||
<pre>
|
||||
var tf = new TableFilter('my-table-id');
|
||||
</pre>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Event</th>
|
||||
<th>Description</th>
|
||||
<th>Remarks</th>
|
||||
<th>Example</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>before-column-calc</th>
|
||||
<td>Event emitted just before a column values calculation is performed</td>
|
||||
<td>
|
||||
Subscribers receive the following parameters:
|
||||
<ul>
|
||||
<li><code>tf</code> - current TableFilter instance</li>
|
||||
<li><code>colOps</code> - current ColOps instance</li>
|
||||
<li><code>colIndex</code> - index of the working column</li>
|
||||
<li><code>values</code> - list of current filtered values</li>
|
||||
<li><code>operation</code> - operation performed ('sum', 'mean', 'min', 'max', 'median', 'q1', 'q3')</li>
|
||||
<li><code>precision</code> - decimal precision applied to the result</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<pre>
|
||||
tf.emitter.on(['before-column-calc'], function(tf, colOps, colIndex, values, operation, precision){
|
||||
console.log(tf, colOps, colIndex, values, operation, precision);
|
||||
});
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>column-calc</th>
|
||||
<td>Event emitted after a calculation is performed</td>
|
||||
<td>
|
||||
Subscribers receive the following parameters:
|
||||
<ul>
|
||||
<li><code>tf</code> - current TableFilter instance</li>
|
||||
<li><code>colOps</code> - current ColOps instance</li>
|
||||
<li><code>colIndex</code> - index of the working column</li>
|
||||
<li><code>result</code> - operation raw result (without precision applied)</li>
|
||||
<li><code>operation</code> - operation performed ('sum', 'mean', 'min', 'max', 'median', 'q1', 'q3')</li>
|
||||
<li><code>precision</code> - decimal precision applied to the result</li>
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
<pre>
|
||||
tf.emitter.on(['column-calc'], function(tf, colOps, colIndex, result, operation, precision){
|
||||
console.log(tf, colOps, colIndex, result, operation, precision);
|
||||
});
|
||||
</pre>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
Loading…
Reference in a new issue