1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-03 07:03:33 +02:00

Added linked filters with disabled options demo

This commit is contained in:
Max Guglielmi 2015-06-13 21:23:33 +10:00
parent 5f2743edd3
commit bede2bac66
20 changed files with 4064 additions and 601 deletions

View file

@ -2674,16 +2674,15 @@ return /******/ (function(modules) { // webpackBootstrap
* 'checklist' type)
*/
value: function linkFilters() {
if (_Types2['default'].isUndef(this.activeFilterId)) {
return;
}
var slcA1 = this.getFiltersByType(this.fltTypeSlc, true),
slcA2 = this.getFiltersByType(this.fltTypeMulti, true),
slcA3 = this.getFiltersByType(this.fltTypeCheckList, true),
slcIndex = slcA1.concat(slcA2);
slcIndex = slcIndex.concat(slcA3);
if (!this.activeFilterId) {
return;
}
var activeFlt = this.activeFilterId.split('_')[0];
activeFlt = activeFlt.split(this.prfxFlt)[1];
var slcSelectedValue = undefined;
@ -4100,7 +4099,12 @@ return /******/ (function(modules) { // webpackBootstrap
this.tblCont = _Dom2['default'].create('div', ['id', this.prfxTblCont + tf.id]);
this.tblCont.className = this.gridContCssClass;
if (this.gridWidth) {
this.tblCont.style.width = this.gridWidth;
if (this.gridWidth.indexOf('%') != -1) {
console.log(this.gridWidth);
this.tblCont.style.width = '100%';
} else {
this.tblCont.style.width = this.gridWidth;
}
}
if (this.gridHeight) {
this.tblCont.style.height = this.gridHeight;
@ -4121,7 +4125,12 @@ return /******/ (function(modules) { // webpackBootstrap
this.headTblCont = _Dom2['default'].create('div', ['id', this.prfxHeadTblCont + tf.id]);
this.headTblCont.className = this.gridHeadContCssClass;
if (this.gridWidth) {
this.headTblCont.style.width = this.gridWidth;
if (this.gridWidth.indexOf('%') != -1) {
console.log(this.gridWidth);
this.headTblCont.style.width = '100%';
} else {
this.headTblCont.style.width = this.gridWidth;
}
}
//Headers table
@ -4185,7 +4194,7 @@ return /******/ (function(modules) { // webpackBootstrap
tf.setColWidths(0, this.headTbl);
//Headers container width
this.headTblCont.style.width = this.tblCont.clientWidth + 'px';
// this.headTblCont.style.width = this.tblCont.clientWidth+'px';
tbl.style.width = '';
//
@ -4290,7 +4299,7 @@ return /******/ (function(modules) { // webpackBootstrap
var thCW = o.crWColsRow.cells[colIndex].clientWidth;
var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth;
if (thCW != tdCW /*&& !Helpers.isIE()*/) {
if (thCW != tdCW) {
o.headTbl.style.width = tbl.clientWidth + 'px';
}
@ -4302,9 +4311,6 @@ return /******/ (function(modules) { // webpackBootstrap
if (tbl.clientWidth !== this.headTbl.clientWidth) {
tbl.style.width = this.headTbl.clientWidth + 'px';
}
// Re-adjust reference row
//tf.refRow = Helpers.isIE() ? (tf.refRow+1) : 0;
}
}, {
key: 'destroy',
@ -5052,7 +5058,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (isLinked && tf.disableExcludedOptions) {
var filteredCol = filteredDataCol[j];
if (!filteredCol) {
filteredCol = this.GetFilteredDataCol(j);
filteredCol = tf.getFilteredDataCol(j);
}
if (!_Arr2['default'].has(filteredCol, cell_string, matchCase) && !_Arr2['default'].has(excludedOpts, cell_string, matchCase) && !this.isFirstLoad) {
excludedOpts.push(cell_data);
@ -5154,7 +5160,7 @@ return /******/ (function(modules) { // webpackBootstrap
var val = this.opts[y]; //option value
var lbl = this.isCustom ? this.optsTxt[y] : val; //option text
var isDisabled = false;
if (isLinked && this.disableExcludedOptions && _Arr2['default'].has(excludedOpts, _Str2['default'].matchCase(val, tf.matchCase), tf.matchCase)) {
if (isLinked && tf.disableExcludedOptions && _Arr2['default'].has(excludedOpts, _Str2['default'].matchCase(val, tf.matchCase), tf.matchCase)) {
isDisabled = true;
}
@ -5294,6 +5300,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.isCustom = null;
this.opts = null;
this.optsTxt = null;
this.excludedOpts = null;
this.tf = tf;
}
@ -5369,10 +5376,9 @@ return /******/ (function(modules) { // webpackBootstrap
activeFlt = activeFlt.split(tf.prfxFlt)[1];
}
var excludedOpts,
filteredDataCol = [];
var filteredDataCol = [];
if (tf.linkedFilters && tf.disableExcludedOptions) {
excludedOpts = [];
this.excludedOpts = [];
}
for (var k = tf.refRow; k < tf.nbRows; k++) {
@ -5403,10 +5409,10 @@ return /******/ (function(modules) { // webpackBootstrap
var filteredCol = filteredDataCol[j];
if (tf.linkedFilters && tf.disableExcludedOptions) {
if (!filteredCol) {
filteredDataCol[j] = tf.GetFilteredDataCol(j);
filteredCol = tf.getFilteredDataCol(j);
}
if (!_Arr2['default'].has(filteredCol, cell_string, tf.matchCase) && !_Arr2['default'].has(excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) {
excludedOpts.push(cell_data);
if (!_Arr2['default'].has(filteredCol, cell_string, tf.matchCase) && !_Arr2['default'].has(this.excludedOpts, cell_string, tf.matchCase) && !tf.isFirstLoad) {
this.excludedOpts.push(cell_data);
}
}
}
@ -5423,13 +5429,13 @@ return /******/ (function(modules) { // webpackBootstrap
if (tf.sortSlc && !this.isCustom) {
if (!tf.matchCase) {
this.opts.sort(_Sort2['default'].ignoreCase);
if (excludedOpts) {
excludedOpts.sort(_Sort2['default'].ignoreCase);
if (this.excludedOpts) {
this.excludedOpts.sort(_Sort2['default'].ignoreCase);
}
} else {
this.opts.sort();
if (excludedOpts) {
excludedOpts.sort();
if (this.excludedOpts) {
this.excludedOpts.sort();
}
}
}
@ -5437,16 +5443,16 @@ return /******/ (function(modules) { // webpackBootstrap
if (tf.sortNumAsc && _Arr2['default'].has(tf.sortNumAsc, colIndex)) {
try {
this.opts.sort(numSortAsc);
if (excludedOpts) {
excludedOpts.sort(numSortAsc);
if (this.excludedOpts) {
this.excludedOpts.sort(numSortAsc);
}
if (this.isCustom) {
this.optsTxt.sort(numSortAsc);
}
} catch (e) {
this.opts.sort();
if (excludedOpts) {
excludedOpts.sort();
if (this.excludedOpts) {
this.excludedOpts.sort();
}
if (this.isCustom) {
this.optsTxt.sort();
@ -5457,16 +5463,16 @@ return /******/ (function(modules) { // webpackBootstrap
if (tf.sortNumDesc && _Arr2['default'].has(tf.sortNumDesc, colIndex)) {
try {
this.opts.sort(numSortDesc);
if (excludedOpts) {
excludedOpts.sort(numSortDesc);
if (this.excludedOpts) {
this.excludedOpts.sort(numSortDesc);
}
if (this.isCustom) {
this.optsTxt.sort(numSortDesc);
}
} catch (e) {
this.opts.sort();
if (excludedOpts) {
excludedOpts.sort();
if (this.excludedOpts) {
this.excludedOpts.sort();
}
if (this.isCustom) {
this.optsTxt.sort();
@ -5511,7 +5517,7 @@ return /******/ (function(modules) { // webpackBootstrap
var lbl = this.isCustom ? this.optsTxt[y] : val; //item text
var li = _Dom2['default'].createCheckItem(tf.fltIds[colIndex] + '_' + (y + chkCt), val, lbl);
li.className = this.checkListItemCssClass;
if (tf.linkedFilters && tf.disableExcludedOptions && _Arr2['default'].has(excludedOpts, _Str2['default'].matchCase(val, tf.matchCase), tf.matchCase)) {
if (tf.linkedFilters && tf.disableExcludedOptions && _Arr2['default'].has(this.excludedOpts, _Str2['default'].matchCase(val, tf.matchCase), tf.matchCase)) {
_Dom2['default'].addClass(li, this.checkListItemDisabledCssClass);
li.check.disabled = true;
li.disabled = true;

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -13006,12 +13007,15 @@
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -22,17 +23,16 @@
<h1>TableFilter v0.0.0</h1>
<h2>Data types demo</h2>
<p>In this example, 3 date types are used and numeric data for currency columns
is formated differently: </p>
<p>This example features 3 date types and 2 numeric formatting for the currency
columns:</p>
<ul>
<li>"." thousands separator and "," decimal separator for &euro;</li>
<li>"," thousands separator and "." decimal separator for US$</li>
</ul>
<p>
Use <code>col_number_format</code> property to set numeric formats
('EU', 'US' or 'IPADDRESS') for columns and <code>col_date_type</code> to
set date types.
Use the <code>col_number_format</code> property to set numeric formats
('EU', 'US' or 'IPADDRESS') and <code>col_date_type</code> to set date
types.
</p>
<pre></pre>
@ -393,105 +393,637 @@
<script src="../dist/tablefilter/tablefilter.js"></script>
<script data-config>
var id = function (id){
return document.getElementById(id);
};
var table = id('demo-tot');
var totRowIndex = table.getElementsByTagName('tr').length;
var id = function (id){
return document.getElementById(id);
};
var table = id('demo-tot');
var totRowIndex = table.getElementsByTagName('tr').length;
var filtersConfig = {
base_path: '../dist/tablefilter/',
filters_row_index: 1,
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
col_number_format: [
null, null, null,
'EU', 'US', null,
null, null, null,
'IpAddress'
],
col_date_type: [
null, null, null,
null, null, null,
'dmy', 'mdy', 'ddmmmyyyy',
null
],
rows_always_visible: [totRowIndex],
on_filters_loaded: function(o){
o.setFilterValue(3, '>1.000');
o.setFilterValue(4, '<2,500');
o.setFilterValue(6, '>23-01-95');
o.filter();
},
extensions:[
{
name: 'sort',
types: [
'number', 'string', 'string',
'US', 'none', 'string'
]
},{
name: 'colOps',
id: ["sum1", "sum2"],
col: [3, 4],
operation: ["sum", "sum"],
write_method: ["innerhtml", 'innerhtml'],
exclude_row: [totRowIndex],
decimal_precision: [2, 2],
tot_row_index: [totRowIndex],
on_after_operation: formatTotals
}
]
};
function addCommas(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
var tf = new TableFilter('demo-tot', filtersConfig);
tf.init();
function addDots(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? ',' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '.' + '$2');
}
return x1 + x2;
}
function addCommas(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
function formatTotals(){
var tot1 = id('sum1').innerHTML;
tot1 = addDots(tot1);
id('sum1').innerHTML = tot1;
var tot2 = id('sum2').innerHTML;
tot2 = addCommas(tot2);
id('sum2').innerHTML = tot2;
}
/* EXAMPLE 1
*********************** */
var tfConfig = {
base_path: '../dist/tablefilter/',
filters_row_index: 1,
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
col_number_format: [
null, null, null,
'EU', 'US', null,
null, null, null,
'IpAddress'
],
col_date_type: [
null, null, null,
null, null, null,
'dmy', 'mdy', 'ddmmmyyyy',
null
],
rows_always_visible: [totRowIndex],
on_filters_loaded: function(o){
o.setFilterValue(3, '>1.000');
o.setFilterValue(4, '<2,500');
o.setFilterValue(6, '>23-01-95');
o.filter();
},
extensions:[
{
name: 'sort',
types: [
'number', 'string', 'string',
'US', 'none', 'string'
]
},{
name: 'colOps',
id: ["sum1", "sum2"],
col: [3, 4],
operation: ["sum", "sum"],
write_method: ["innerhtml", 'innerhtml'],
exclude_row: [totRowIndex],
decimal_precision: [2, 2],
tot_row_index: [totRowIndex],
on_after_operation: formatTotals
}
return x1 + x2;
}
]
};
function addDots(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? ',' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '.' + '$2');
}
return x1 + x2;
}
function formatTotals(){
var tot1 = id('sum1').innerHTML;
tot1 = addDots(tot1);
id('sum1').innerHTML = tot1;
var tot2 = id('sum2').innerHTML;
tot2 = addCommas(tot2);
id('sum2').innerHTML = tot2;
}
var tf = new TableFilter('demo-tot', tfConfig);
tf.init();
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
<p>Below an example of ISO date support (YMD). Use <code>default_date_type</code>
to set a date type for a whole table ('DMY','MDY','YMD').</p>
<table id="demo">
<thead>
<tr>
<th>Email</th>
<th>Id</th>
<th>Phone</th>
<th>Total</th>
<th>Url</th>
<th>ISO Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>found@mountdev.net</td>
<td>03519</td>
<td>941-964-1599</td>
<td>$1176.48</td>
<td>http://donuts.com</td>
<td>2000/8/6</td>
</tr>
<tr>
<td>lost@fish.org</td>
<td>36628</td>
<td>941-964-5975</td>
<td>$822.23</td>
<td>http://www.gmail.com</td>
<td>1994/7/14</td>
</tr>
<tr>
<td>mendez@dotnet.ca</td>
<td>90442</td>
<td>941-964-1649</td>
<td>$1985.72</td>
<td>http://reno.gov</td>
<td>1997/10/20</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>00412</td>
<td>941-964-6432</td>
<td>$1834.77</td>
<td>http://gmail.com</td>
<td>1998/8/23</td>
</tr>
<tr>
<td>foo@fish.org</td>
<td>80653</td>
<td>941-964-1022</td>
<td>$260.26</td>
<td>http://samba.org</td>
<td>1991/11/24</td>
</tr>
<tr>
<td>found@fish.org</td>
<td>54635</td>
<td>941-964-6439</td>
<td>$1442.80</td>
<td>http://dotnet.ca</td>
<td>1987/7/12</td>
</tr>
<tr>
<td>found@flexomat.com</td>
<td>20953</td>
<td>941-964-5544</td>
<td>$575.42</td>
<td>http://gmail.com</td>
<td>1988/6/10</td>
</tr>
<tr>
<td>lost@aftonbladet.se</td>
<td>60810</td>
<td>941-964-8406</td>
<td>$1054.39</td>
<td>http://www.samba.org</td>
<td>1988/5/18</td>
</tr>
<tr>
<td>carl@reno.gov</td>
<td>22666</td>
<td>941-964-104</td>
<td>$373.59</td>
<td>http://www.lostnfound.org</td>
<td>1981/11/5</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>82867</td>
<td>941-964-1031</td>
<td>$631.03</td>
<td>http://www.reno.gov</td>
<td>1985/1/22</td>
</tr>
<tr>
<td>foo@donuts.com</td>
<td>11268</td>
<td>941-964-208</td>
<td>$3730.64</td>
<td>http://aftonbladet.se</td>
<td>1989/8/4</td>
</tr>
<tr>
<td>devo@google.se</td>
<td>17059</td>
<td>941-964-2903</td>
<td>$1404.67</td>
<td>http://www.gmail.com</td>
<td>1983/4/28</td>
</tr>
<tr>
<td>muffins@flexomat.com</td>
<td>90584</td>
<td>941-964-4640</td>
<td>$3706.01</td>
<td>http://www.fish.org</td>
<td>1997/4/8</td>
</tr>
<tr>
<td>foo@samba.org</td>
<td>82966</td>
<td>941-964-7245</td>
<td>$1001.38</td>
<td>http://www.reno.gov</td>
<td>1995/11/1</td>
</tr>
<tr>
<td>foo@reno.gov</td>
<td>03603</td>
<td>941-964-8942</td>
<td>$1677.07</td>
<td>http://www.flexomat.com</td>
<td>1980/7/31</td>
</tr>
<tr>
<td>found@flexomat.com</td>
<td>84939</td>
<td>941-964-7004</td>
<td>$3916.83</td>
<td>http://www.fish.org</td>
<td>1980/8/26</td>
</tr>
<tr>
<td>henry@lostnfound.org</td>
<td>76453</td>
<td>941-964-3084</td>
<td>$3875.88</td>
<td>http://www.fish.org</td>
<td>2000/10/22</td>
</tr>
<tr>
<td>sam@aftonbladet.se</td>
<td>36274</td>
<td>941-964-7784</td>
<td>$73.43</td>
<td>http://www.dn.se</td>
<td>1994/11/11</td>
</tr>
<tr>
<td>dev@polyester.se</td>
<td>15971</td>
<td>941-964-7527</td>
<td>$1855.18</td>
<td>http://www.flexomat.com</td>
<td>1984/8/16</td>
</tr>
<tr>
<td>devo@fish.org</td>
<td>31734</td>
<td>941-964-9760</td>
<td>$3201.35</td>
<td>http://www.samba.org</td>
<td>1989/3/4</td>
</tr>
<tr>
<td>devo@reno.gov</td>
<td>52074</td>
<td>941-964-2068</td>
<td>$3035.24</td>
<td>http://www.dn.se</td>
<td>1998/2/24</td>
</tr>
<tr>
<td>mendez@fish.org</td>
<td>87800</td>
<td>941-964-7933</td>
<td>$618.59</td>
<td>http://www.dn.se</td>
<td>1989/5/28</td>
</tr>
<tr>
<td>muffins@reno.gov</td>
<td>95926</td>
<td>941-964-147</td>
<td>$3897.91</td>
<td>http://www.flexomat.com</td>
<td>2003/4/1</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>74513</td>
<td>941-964-4507</td>
<td>$2150.68</td>
<td>http://www.fish.org</td>
<td>1987/4/8</td>
</tr>
<tr>
<td>sam@fish.org</td>
<td>82420</td>
<td>941-964-2134</td>
<td>$3947.54</td>
<td>http://mountdev.net</td>
<td>1990/11/26</td>
</tr>
<tr>
<td>devo@mountdev.net</td>
<td>81905</td>
<td>941-964-3535</td>
<td>$722.17</td>
<td>http://fish.org</td>
<td>1985/12/28</td>
</tr>
<tr>
<td>john@lostnfound.org</td>
<td>93124</td>
<td>941-964-1508</td>
<td>$394.82</td>
<td>http://www.mountdev.net</td>
<td>1989/12/10</td>
</tr>
<tr>
<td>adam@google.se</td>
<td>51938</td>
<td>941-964-5533</td>
<td>$3519.06</td>
<td>http://dotnet.ca</td>
<td>1986/6/27</td>
</tr>
<tr>
<td>carl@lostnfound.org</td>
<td>51270</td>
<td>941-964-805</td>
<td>$2101.59</td>
<td>http://flexomat.com</td>
<td>1987/10/25</td>
</tr>
<tr>
<td>muffins@dotnet.ca</td>
<td>44995</td>
<td>941-964-8299</td>
<td>$1708.57</td>
<td>http://fish.org</td>
<td>1987/9/24</td>
</tr>
<tr>
<td>adam@samba.org</td>
<td>04065</td>
<td>941-964-8643</td>
<td>$1461.31</td>
<td>http://polyester.se</td>
<td>1993/9/13</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>01801</td>
<td>941-964-1839</td>
<td>$2434.33</td>
<td>http://www.google.se</td>
<td>1987/7/8</td>
</tr>
<tr>
<td>muffins@mountdev.net</td>
<td>49570</td>
<td>941-964-877</td>
<td>$3273.22</td>
<td>http://polyester.se</td>
<td>2000/4/23</td>
</tr>
<tr>
<td>dev@google.se</td>
<td>31947</td>
<td>941-964-3956</td>
<td>$1647.20</td>
<td>http://www.dn.se</td>
<td>2006/9/25</td>
</tr>
<tr>
<td>christian@fish.org</td>
<td>05775</td>
<td>941-964-9882</td>
<td>$3203.96</td>
<td>http://flexomat.com</td>
<td>1981/5/3</td>
</tr>
<tr>
<td>henry@mountdev.net</td>
<td>18946</td>
<td>941-964-5204</td>
<td>$3281.09</td>
<td>http://www.lostnfound.org</td>
<td>1989/9/29</td>
</tr>
<tr>
<td>carl@mountdev.net</td>
<td>39096</td>
<td>941-964-5708</td>
<td>$1788.11</td>
<td>http://www.samba.org</td>
<td>1983/2/7</td>
</tr>
<tr>
<td>sam@dn.se</td>
<td>45043</td>
<td>941-964-7175</td>
<td>$1254.08</td>
<td>http://google.se</td>
<td>1981/3/30</td>
</tr>
<tr>
<td>henry@dotnet.ca</td>
<td>41456</td>
<td>941-964-4812</td>
<td>$1779.17</td>
<td>http://mountdev.net</td>
<td>1980/9/11</td>
</tr>
<tr>
<td>christian@polyester.se</td>
<td>78584</td>
<td>941-964-6967</td>
<td>$3956.45</td>
<td>http://www.reno.gov</td>
<td>1982/7/24</td>
</tr>
<tr>
<td>muffins@flexomat.com</td>
<td>56098</td>
<td>941-964-9399</td>
<td>$558.88</td>
<td>http://www.fish.org</td>
<td>1981/3/1</td>
</tr>
<tr>
<td>muffins@gmail.com</td>
<td>92303</td>
<td>941-964-1958</td>
<td>$1094.38</td>
<td>http://www.fish.org</td>
<td>1983/1/10</td>
</tr>
<tr>
<td>christian@mountdev.net</td>
<td>96564</td>
<td>941-964-3947</td>
<td>$3593.94</td>
<td>http://www.dn.se</td>
<td>2004/11/26</td>
</tr>
<tr>
<td>lost@polyester.se</td>
<td>53352</td>
<td>941-964-7300</td>
<td>$1548.49</td>
<td>http://www.mountdev.net</td>
<td>1989/7/22</td>
</tr>
<tr>
<td>adam@flexomat.com</td>
<td>17411</td>
<td>941-964-6808</td>
<td>$3744.57</td>
<td>http://www.lostnfound.org</td>
<td>1998/4/17</td>
</tr>
<tr>
<td>john@gmail.com</td>
<td>55140</td>
<td>941-964-5592</td>
<td>$641.84</td>
<td>http://www.dn.se</td>
<td>1989/12/15</td>
</tr>
<tr>
<td>foo@google.se</td>
<td>19355</td>
<td>941-964-5290</td>
<td>$3053.28</td>
<td>http://donuts.com</td>
<td>1987/6/25</td>
</tr>
<tr>
<td>dev@dn.se</td>
<td>38729</td>
<td>941-964-1565</td>
<td>$1539.30</td>
<td>http://www.flexomat.com</td>
<td>1989/3/13</td>
</tr>
<tr>
<td>mendez@dn.se</td>
<td>22531</td>
<td>941-964-4285</td>
<td>$18.39</td>
<td>http://google.se</td>
<td>1996/8/19</td>
</tr>
<tr>
<td>found@mountdev.net</td>
<td>03979</td>
<td>941-964-3119</td>
<td>$2961.55</td>
<td>http://www.dotnet.ca</td>
<td>2005/5/27</td>
</tr>
<tr>
<td>foo@reno.gov</td>
<td>59240</td>
<td>941-964-3593</td>
<td>$3039.37</td>
<td>http://www.lostnfound.org</td>
<td>2005/8/27</td>
</tr>
<tr>
<td>dev@polyester.se</td>
<td>53160</td>
<td>941-964-8179</td>
<td>$468.97</td>
<td>http://www.samba.org</td>
<td>1988/10/23</td>
</tr>
<tr>
<td>christian@reno.gov</td>
<td>96671</td>
<td>941-964-99</td>
<td>$994.56</td>
<td>http://gmail.com</td>
<td>1984/4/22</td>
</tr>
<tr>
<td>christian@gmail.com</td>
<td>60247</td>
<td>941-964-341</td>
<td>$1358.07</td>
<td>http://www.donuts.com</td>
<td>1987/11/20</td>
</tr>
<tr>
<td>lost@dotnet.ca</td>
<td>92437</td>
<td>941-964-6495</td>
<td>$3384.20</td>
<td>http://mountdev.net</td>
<td>1982/10/14</td>
</tr>
<tr>
<td>dev@flexomat.com</td>
<td>08314</td>
<td>941-964-5549</td>
<td>$223.00</td>
<td>http://flexomat.com</td>
<td>1985/12/6</td>
</tr>
<tr>
<td>henry@lostnfound.org</td>
<td>46306</td>
<td>941-964-8496</td>
<td>$3170.19</td>
<td>http://www.dotnet.ca</td>
<td>1986/7/7</td>
</tr>
<tr>
<td>foo@mountdev.net</td>
<td>07328</td>
<td>941-964-3503</td>
<td>$2486.92</td>
<td>http://www.dn.se</td>
<td>1999/7/24</td>
</tr>
<tr>
<td>lost@flexomat.com</td>
<td>66996</td>
<td>941-964-5705</td>
<td>$3333.71</td>
<td>http://www.aftonbladet.se</td>
<td>1989/1/17</td>
</tr>
<tr>
<td>henry@donuts.com</td>
<td>83394</td>
<td>941-964-3776</td>
<td>$1808.67</td>
<td>http://dn.se</td>
<td>1981/6/14</td>
</tr>
<tr>
<td>muffins@fish.org</td>
<td>76935</td>
<td>941-964-5150</td>
<td>$403.02</td>
<td>http://www.samba.org</td>
<td>1986/7/13</td>
</tr>
</tbody>
</table>
<script data-config>
/* EXAMPLE 2
*********************** */
var tf2Config = {
base_path: '../dist/tablefilter/',
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
default_date_type: 'YMD',
on_filters_loaded: function(o){
o.setFilterValue(5, '>95-05-18');
o.filter();
}
};
var tf2 = new TableFilter('demo', tf2Config);
tf2.init();
</script>
<script>
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -13031,12 +13032,15 @@
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -13012,12 +13013,15 @@
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

File diff suppressed because it is too large Load diff

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -33,24 +34,24 @@
<table id="demo">
<thead>
<tr>
<th width="55">Rank</th>
<th width="170">Continent/Region</th>
<th width="210">Country / Territory</th>
<th width="104">Area (km²)</th>
<th width="63" align="center">% of Total</th>
<th>Rank</th>
<th>Continent/Region</th>
<th>Country / Territory</th>
<th>Area (km²)</th>
<th align="center">% of Total</th>
<th align="center">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td >&mdash;</td>
<td>&mdash;</td>
<td>Solar System </td>
<td>Earth</td>
<td align="right">148,940,000</td>
<td align="right">100%</td>
<td>Total land coverage (29.2% of Earth's surface)</td>
</tr>
<tr class="alt">
<tr>
<td>1</td>
<td>Asia /Europe </td>
<td>
@ -2603,12 +2604,15 @@
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

View file

@ -6,11 +6,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;
@ -13031,12 +13032,15 @@
</script>
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>
</body>

View file

@ -41,6 +41,7 @@ export class CheckList{
this.isCustom = null;
this.opts = null;
this.optsTxt = null;
this.excludedOpts = null;
this.tf = tf;
}
@ -106,10 +107,9 @@ export class CheckList{
activeFlt = activeFlt.split(tf.prfxFlt)[1];
}
var excludedOpts,
filteredDataCol = [];
var filteredDataCol = [];
if(tf.linkedFilters && tf.disableExcludedOptions){
excludedOpts = [];
this.excludedOpts = [];
}
for(var k=tf.refRow; k<tf.nbRows; k++){
@ -147,14 +147,14 @@ export class CheckList{
var filteredCol = filteredDataCol[j];
if(tf.linkedFilters && tf.disableExcludedOptions){
if(!filteredCol){
filteredDataCol[j] = tf.GetFilteredDataCol(j);
filteredCol = tf.getFilteredDataCol(j);
}
if(!Arr.has(filteredCol,
cell_string, tf.matchCase) &&
!Arr.has(excludedOpts,
!Arr.has(this.excludedOpts,
cell_string, tf.matchCase) &&
!tf.isFirstLoad){
excludedOpts.push(cell_data);
this.excludedOpts.push(cell_data);
}
}
}
@ -171,13 +171,13 @@ export class CheckList{
if(tf.sortSlc && !this.isCustom){
if (!tf.matchCase){
this.opts.sort(Sort.ignoreCase);
if(excludedOpts){
excludedOpts.sort(Sort.ignoreCase);
if(this.excludedOpts){
this.excludedOpts.sort(Sort.ignoreCase);
}
} else {
this.opts.sort();
if(excludedOpts){
excludedOpts.sort();
if(this.excludedOpts){
this.excludedOpts.sort();
}
}
}
@ -185,16 +185,16 @@ export class CheckList{
if(tf.sortNumAsc && Arr.has(tf.sortNumAsc, colIndex)){
try{
this.opts.sort(numSortAsc);
if(excludedOpts){
excludedOpts.sort(numSortAsc);
if(this.excludedOpts){
this.excludedOpts.sort(numSortAsc);
}
if(this.isCustom){
this.optsTxt.sort(numSortAsc);
}
} catch(e) {
this.opts.sort();
if(excludedOpts){
excludedOpts.sort();
if(this.excludedOpts){
this.excludedOpts.sort();
}
if(this.isCustom){
this.optsTxt.sort();
@ -205,16 +205,16 @@ export class CheckList{
if(tf.sortNumDesc && Arr.has(tf.sortNumDesc, colIndex)){
try{
this.opts.sort(numSortDesc);
if(excludedOpts){
excludedOpts.sort(numSortDesc);
if(this.excludedOpts){
this.excludedOpts.sort(numSortDesc);
}
if(this.isCustom){
this.optsTxt.sort(numSortDesc);
}
} catch(e) {
this.opts.sort();
if(excludedOpts){
excludedOpts.sort(); }
if(this.excludedOpts){
this.excludedOpts.sort(); }
if(this.isCustom){
this.optsTxt.sort();
}
@ -258,7 +258,7 @@ export class CheckList{
tf.fltIds[colIndex]+'_'+(y+chkCt), val, lbl);
li.className = this.checkListItemCssClass;
if(tf.linkedFilters && tf.disableExcludedOptions &&
Arr.has(excludedOpts,
Arr.has(this.excludedOpts,
Str.matchCase(val, tf.matchCase), tf.matchCase)){
Dom.addClass(li, this.checkListItemDisabledCssClass);
li.check.disabled = true;

View file

@ -150,7 +150,7 @@ export class Dropdown{
if(isLinked && tf.disableExcludedOptions){
var filteredCol = filteredDataCol[j];
if(!filteredCol){
filteredCol = this.GetFilteredDataCol(j);
filteredCol = tf.getFilteredDataCol(j);
}
if(!Arr.has(filteredCol, cell_string, matchCase) &&
!Arr.has(
@ -252,7 +252,7 @@ export class Dropdown{
var val = this.opts[y]; //option value
var lbl = this.isCustom ? this.optsTxt[y] : val; //option text
var isDisabled = false;
if(isLinked && this.disableExcludedOptions &&
if(isLinked && tf.disableExcludedOptions &&
Arr.has(
excludedOpts,
Str.matchCase(val, tf.matchCase),

View file

@ -114,7 +114,12 @@ export class GridLayout{
this.tblCont = Dom.create('div',['id', this.prfxTblCont + tf.id]);
this.tblCont.className = this.gridContCssClass;
if(this.gridWidth){
this.tblCont.style.width = this.gridWidth;
if(this.gridWidth.indexOf('%') != -1){
console.log(this.gridWidth);
this.tblCont.style.width = '100%';
} else {
this.tblCont.style.width = this.gridWidth;
}
}
if(this.gridHeight){
this.tblCont.style.height = this.gridHeight;
@ -137,7 +142,12 @@ export class GridLayout{
'div',['id', this.prfxHeadTblCont + tf.id]);
this.headTblCont.className = this.gridHeadContCssClass;
if(this.gridWidth){
this.headTblCont.style.width = this.gridWidth;
if(this.gridWidth.indexOf('%') != -1){
console.log(this.gridWidth);
this.headTblCont.style.width = '100%';
} else {
this.headTblCont.style.width = this.gridWidth;
}
}
//Headers table
@ -201,7 +211,7 @@ export class GridLayout{
tf.setColWidths(0, this.headTbl);
//Headers container width
this.headTblCont.style.width = this.tblCont.clientWidth+'px';
// this.headTblCont.style.width = this.tblCont.clientWidth+'px';
tbl.style.width = '';
//
@ -307,7 +317,7 @@ export class GridLayout{
var thCW = o.crWColsRow.cells[colIndex].clientWidth;
var tdCW = o.crWRowDataTbl.cells[colIndex].clientWidth;
if(thCW != tdCW /*&& !Helpers.isIE()*/){
if(thCW != tdCW){
o.headTbl.style.width = tbl.clientWidth+'px';
}
@ -319,9 +329,6 @@ export class GridLayout{
if(tbl.clientWidth !== this.headTbl.clientWidth){
tbl.style.width = this.headTbl.clientWidth+'px';
}
// Re-adjust reference row
//tf.refRow = Helpers.isIE() ? (tf.refRow+1) : 0;
}
/**

View file

@ -2503,16 +2503,15 @@ export class TableFilter{
* 'checklist' type)
*/
linkFilters(){
if(Types.isUndef(this.activeFilterId)){
return;
}
let slcA1 = this.getFiltersByType(this.fltTypeSlc, true),
slcA2 = this.getFiltersByType(this.fltTypeMulti, true),
slcA3 = this.getFiltersByType(this.fltTypeCheckList, true),
slcIndex = slcA1.concat(slcA2);
slcIndex = slcIndex.concat(slcA3);
if(!this.activeFilterId){
return;
}
let activeFlt = this.activeFilterId.split('_')[0];
activeFlt = activeFlt.split(this.prfxFlt)[1];
let slcSelectedValue;

View file

@ -2,24 +2,24 @@
<table id="demo">
<thead>
<tr>
<th width="55">Rank</th>
<th width="170">Continent/Region</th>
<th width="210">Country / Territory</th>
<th width="104">Area (km²)</th>
<th width="63" align="center">% of Total</th>
<th>Rank</th>
<th>Continent/Region</th>
<th>Country / Territory</th>
<th>Area (km²)</th>
<th align="center">% of Total</th>
<th align="center">Notes</th>
</tr>
</thead>
<tbody>
<tr>
<td >&mdash;</td>
<td>&mdash;</td>
<td>Solar System </td>
<td>Earth</td>
<td align="right">148,940,000</td>
<td align="right">100%</td>
<td>Total land coverage (29.2% of Earth's surface)</td>
</tr>
<tr class="alt">
<tr>
<td>1</td>
<td>Asia /Europe </td>
<td>

View file

@ -5,335 +5,499 @@
<th>Email</th>
<th>Id</th>
<th>Phone</th>
<th>&euro;</th>
<th>US $</th>
<th>Total</th>
<th>Url</th>
<th>EU Date</th>
<th>US Date</th>
<th>DD-MMM-YYYY Date</th>
<th>IP</th>
<th>ISO Date</th>
</tr>
</thead>
<tbody>
<tr>
<td>devo@flexomat.com</td>
<td>66672</td>
<td>941-964-8535</td>
<td>
<div align="right">2.482,79</div>
</td>
<td>
<div align="right">2,482.79</div>
</td>
<td>http://gmail.com</td>
<td>14/12/1988</td>
<td>12/14/1988</td>
<td>14-Dec-1988</td>
<td>186.114.137.213</td>
</tr>
<tr>
<td>henry@mountdev.net</td>
<td>35889</td>
<td>941-964-9543</td>
<td>
<div align="right">2.776,09</div>
</td>
<td>
<div align="right">2,776.09</div>
</td>
<td>http://www.gmail.com</td>
<td>19/1/1984</td>
<td>1/19/1984</td>
<td>19-Jan-1984</td>
<td>170.138.54.12</td>
</tr>
<tr>
<td>christian@reno.gov</td>
<td>60021</td>
<td>941-964-5617</td>
<td>
<div align="right">2.743,41</div>
</td>
<td>
<div align="right">2,743.41</div>
</td>
<td>http://www.dotnet.ca</td>
<td>25/3/2000</td>
<td>3/25/2000</td>
<td>25-Mar-2000</td>
<td>219.115.156.141</td>
</tr>
<tr>
<td>muffins@donuts.com</td>
<td>17927</td>
<td>941-964-9511</td>
<td>
<div align="right">2.998,18</div>
</td>
<td>
<div align="right">2,998.18</div>
</td>
<td>http://google.se</td>
<td>24/1/1993</td>
<td>1/24/1993</td>
<td>24-Jan-1993</td>
<td>252.253.244.189</td>
</tr>
<tr>
<td>muffins@reno.gov</td>
<td>76375</td>
<td>941-964-2757</td>
<td>
<div align="right">1.836,09</div>
</td>
<td>
<div align="right">1,836.09</div>
</td>
<td>http://www.samba.org</td>
<td>4/4/1988</td>
<td>4/4/1988</td>
<td>4-Apr-1988</td>
<td>88.233.9.89</td>
</tr>
<tr>
<td>mendez@gmail.com</td>
<td>45834</td>
<td>941-964-2575</td>
<td>
<div align="right">2.805,46</div>
</td>
<td>
<div align="right">2,805.46</div>
</td>
<td>http://flexomat.com</td>
<td>12/12/1985</td>
<td>12/12/1985</td>
<td>12-Dec-1985</td>
<td>88.233.9.89</td>
</tr>
<tr>
<td>dev@gmail.com</td>
<td>20022</td>
<td>941-964-4967</td>
<td>
<div align="right">3.296,54</div>
</td>
<td>
<div align="right">3,296.54</div>
</td>
<td>http://www.flexomat.com</td>
<td>3/7/2002</td>
<td>7/3/2002</td>
<td>3-Jul-2002</td>
<td>219.115.156.145</td>
</tr>
<tr>
<td>foo@polyester.se</td>
<td>55987</td>
<td>941-964-745</td>
<td>
<div align="right">2.953,73</div>
</td>
<td>
<div align="right">2,953.73</div>
</td>
<td>http://www.donuts.com</td>
<td>4/8/1987</td>
<td>8/4/1987</td>
<td>4-Aug-1987</td>
<td>88.233.9.87</td>
</tr>
<tr>
<td>adam@aftonbladet.se</td>
<td>38867</td>
<td>941-964-6302</td>
<td>
<div align="right">1.949,27</div>
</td>
<td>
<div align="right">1,949.27</div>
</td>
<td>http://flexomat.com</td>
<td>27/7/1995</td>
<td>7/27/1995</td>
<td>27-Jul-1995</td>
<td>170.138.54.16</td>
</tr>
<tr>
<td>devo@donuts.com</td>
<td>51426</td>
<td>941-964-1234</td>
<td>
<div align="right">1.067,00</div>
</td>
<td>
<div align="right">1,067.00</div>
</td>
<td>http://www.polyester.se</td>
<td>5/1/1986</td>
<td>1/5/1986</td>
<td>5-Jan-1986</td>
<td>252.253.244.186</td>
</tr>
<tr>
<td>henry@samba.org</td>
<td>40859</td>
<td>941-964-4856</td>
<td>
<div align="right">3.401,19</div>
</td>
<td>
<div align="right">3,401.19</div>
</td>
<td>http://www.flexomat.com</td>
<td>7/3/1990</td>
<td>3/7/1990</td>
<td>7-Mar-1990</td>
<td>88.233.9.85</td>
</tr>
<tr>
<td>found@dotnet.ca</td>
<td>23986</td>
<td>941-964-2686</td>
<td>
<div align="right">1.393,52</div>
</td>
<td>
<div align="right">1,393.52</div>
</td>
<td>http://lostnfound.org</td>
<td>22/7/1993</td>
<td>7/22/1993</td>
<td>22-Jul-1993</td>
<td>113.231.1.44</td>
</tr>
<tr>
<td>carl@fish.org</td>
<td>73392</td>
<td>941-964-5792</td>
<td>
<div align="right">3.876,04</div>
</td>
<td>
<div align="right">3,876.04</div>
</td>
<td>http://www.google.se</td>
<td>14/7/1984</td>
<td>7/14/1984</td>
<td>14-Jul-1984</td>
<td>219.115.156.137</td>
</tr>
<tr>
<td>found@mountdev.net</td>
<td>03519</td>
<td>941-964-1599</td>
<td>
<div align="right">1.176,48</div>
</td>
<td>
<div align="right">1,176.48</div>
</td>
<td>$1176.48</td>
<td>http://donuts.com</td>
<td>6/8/2000</td>
<td>8/6/2000</td>
<td>6-Aug-2000</td>
<td>88.233.9.86</td>
<td>2000/8/6</td>
</tr>
<tr>
<td>lost@fish.org</td>
<td>36628</td>
<td>941-964-5985</td>
<td>
<div align="right">822,23</div>
</td>
<td>
<div align="right">822.23</div>
</td>
<td>941-964-5975</td>
<td>$822.23</td>
<td>http://www.gmail.com</td>
<td>14/7/1994</td>
<td>7/14/1994</td>
<td>14-Jul-1994</td>
<td>252.253.244.184</td>
<td>1994/7/14</td>
</tr>
<tr>
<td>mendez@dotnet.ca</td>
<td>90442</td>
<td>941-964-1649</td>
<td>
<div align="right">1.985,72</div>
</td>
<td>
<div align="right">1,975.72</div>
</td>
<td>$1985.72</td>
<td>http://reno.gov</td>
<td>20/10/1997</td>
<td>10/20/1997</td>
<td>20-Oct-1997</td>
<td>113.231.1.79</td>
<td>1997/10/20</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>00412</td>
<td>941-964-6432</td>
<td>
<div align="right">1.834,77</div>
</td>
<td>
<div align="right">1,834.77</div>
</td>
<td>$1834.77</td>
<td>http://gmail.com</td>
<td>23/8/1997</td>
<td>8/23/1997</td>
<td>23-Aug-1997</td>
<td>170.138.54.19</td>
<td>1998/8/23</td>
</tr>
<tr>
<td>foo@fish.org</td>
<td>80653</td>
<td>941-964-1022</td>
<td>
<div align="right">260,26</div>
</td>
<td>
<div align="right">260.26</div>
</td>
<td>$260.26</td>
<td>http://samba.org</td>
<td>24/11/1991</td>
<td>11/24/1991</td>
<td>24-Nov-1991</td>
<td>88.233.9.89</td>
<td>1991/11/24</td>
</tr>
<tr>
<td>found@fish.org</td>
<td>54635</td>
<td>941-964-6439</td>
<td>
<div align="right">1.442,80</div>
</td>
<td>
<div align="right">1,442.80</div>
</td>
<td>$1442.80</td>
<td>http://dotnet.ca</td>
<td>12/7/1987</td>
<td>7/12/1987</td>
<td>12-Jul-1987</td>
<td>88.233.9.90</td>
<td>1987/7/12</td>
</tr>
<tr>
<td>found@flexomat.com</td>
<td>20953</td>
<td>941-964-5544</td>
<td>
<div align="right">575,42</div>
</td>
<td>
<div align="right">575.42</div>
</td>
<td>$575.42</td>
<td>http://gmail.com</td>
<td>10/6/1988</td>
<td>6/10/1988</td>
<td>10-Jun-1988</td>
<td>88.233.19.89</td>
<td>1988/6/10</td>
</tr>
<tr>
<td>lost@aftonbladet.se</td>
<td>60810</td>
<td>941-964-8406</td>
<td>$1054.39</td>
<td>http://www.samba.org</td>
<td>1988/5/18</td>
</tr>
<tr>
<td>carl@reno.gov</td>
<td>22666</td>
<td>941-964-104</td>
<td>$373.59</td>
<td>http://www.lostnfound.org</td>
<td>1981/11/5</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>82867</td>
<td>941-964-1031</td>
<td>$631.03</td>
<td>http://www.reno.gov</td>
<td>1985/1/22</td>
</tr>
<tr>
<td>foo@donuts.com</td>
<td>11268</td>
<td>941-964-208</td>
<td>$3730.64</td>
<td>http://aftonbladet.se</td>
<td>1989/8/4</td>
</tr>
<tr>
<td>devo@google.se</td>
<td>17059</td>
<td>941-964-2903</td>
<td>$1404.67</td>
<td>http://www.gmail.com</td>
<td>1983/4/28</td>
</tr>
<tr>
<td>muffins@flexomat.com</td>
<td>90584</td>
<td>941-964-4640</td>
<td>$3706.01</td>
<td>http://www.fish.org</td>
<td>1997/4/8</td>
</tr>
<tr>
<td>foo@samba.org</td>
<td>82966</td>
<td>941-964-7245</td>
<td>$1001.38</td>
<td>http://www.reno.gov</td>
<td>1995/11/1</td>
</tr>
<tr>
<td>foo@reno.gov</td>
<td>03603</td>
<td>941-964-8942</td>
<td>$1677.07</td>
<td>http://www.flexomat.com</td>
<td>1980/7/31</td>
</tr>
<tr>
<td>found@flexomat.com</td>
<td>84939</td>
<td>941-964-7004</td>
<td>$3916.83</td>
<td>http://www.fish.org</td>
<td>1980/8/26</td>
</tr>
<tr>
<td>henry@lostnfound.org</td>
<td>76453</td>
<td>941-964-3084</td>
<td>$3875.88</td>
<td>http://www.fish.org</td>
<td>2000/10/22</td>
</tr>
<tr>
<td>sam@aftonbladet.se</td>
<td>36274</td>
<td>941-964-7784</td>
<td>$73.43</td>
<td>http://www.dn.se</td>
<td>1994/11/11</td>
</tr>
<tr>
<td>dev@polyester.se</td>
<td>15971</td>
<td>941-964-7527</td>
<td>$1855.18</td>
<td>http://www.flexomat.com</td>
<td>1984/8/16</td>
</tr>
<tr>
<td>devo@fish.org</td>
<td>31734</td>
<td>941-964-9760</td>
<td>$3201.35</td>
<td>http://www.samba.org</td>
<td>1989/3/4</td>
</tr>
<tr>
<td>devo@reno.gov</td>
<td>52074</td>
<td>941-964-2068</td>
<td>$3035.24</td>
<td>http://www.dn.se</td>
<td>1998/2/24</td>
</tr>
<tr>
<td>mendez@fish.org</td>
<td>87800</td>
<td>941-964-7933</td>
<td>$618.59</td>
<td>http://www.dn.se</td>
<td>1989/5/28</td>
</tr>
<tr>
<td>muffins@reno.gov</td>
<td>95926</td>
<td>941-964-147</td>
<td>$3897.91</td>
<td>http://www.flexomat.com</td>
<td>2003/4/1</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>74513</td>
<td>941-964-4507</td>
<td>$2150.68</td>
<td>http://www.fish.org</td>
<td>1987/4/8</td>
</tr>
<tr>
<td>sam@fish.org</td>
<td>82420</td>
<td>941-964-2134</td>
<td>$3947.54</td>
<td>http://mountdev.net</td>
<td>1990/11/26</td>
</tr>
<tr>
<td>devo@mountdev.net</td>
<td>81905</td>
<td>941-964-3535</td>
<td>$722.17</td>
<td>http://fish.org</td>
<td>1985/12/28</td>
</tr>
<tr>
<td>john@lostnfound.org</td>
<td>93124</td>
<td>941-964-1508</td>
<td>$394.82</td>
<td>http://www.mountdev.net</td>
<td>1989/12/10</td>
</tr>
<tr>
<td>adam@google.se</td>
<td>51938</td>
<td>941-964-5533</td>
<td>$3519.06</td>
<td>http://dotnet.ca</td>
<td>1986/6/27</td>
</tr>
<tr>
<td>carl@lostnfound.org</td>
<td>51270</td>
<td>941-964-805</td>
<td>$2101.59</td>
<td>http://flexomat.com</td>
<td>1987/10/25</td>
</tr>
<tr>
<td>muffins@dotnet.ca</td>
<td>44995</td>
<td>941-964-8299</td>
<td>$1708.57</td>
<td>http://fish.org</td>
<td>1987/9/24</td>
</tr>
<tr>
<td>adam@samba.org</td>
<td>04065</td>
<td>941-964-8643</td>
<td>$1461.31</td>
<td>http://polyester.se</td>
<td>1993/9/13</td>
</tr>
<tr>
<td>carl@donuts.com</td>
<td>01801</td>
<td>941-964-1839</td>
<td>$2434.33</td>
<td>http://www.google.se</td>
<td>1987/7/8</td>
</tr>
<tr>
<td>muffins@mountdev.net</td>
<td>49570</td>
<td>941-964-877</td>
<td>$3273.22</td>
<td>http://polyester.se</td>
<td>2000/4/23</td>
</tr>
<tr>
<td>dev@google.se</td>
<td>31947</td>
<td>941-964-3956</td>
<td>$1647.20</td>
<td>http://www.dn.se</td>
<td>2006/9/25</td>
</tr>
<tr>
<td>christian@fish.org</td>
<td>05775</td>
<td>941-964-9882</td>
<td>$3203.96</td>
<td>http://flexomat.com</td>
<td>1981/5/3</td>
</tr>
<tr>
<td>henry@mountdev.net</td>
<td>18946</td>
<td>941-964-5204</td>
<td>$3281.09</td>
<td>http://www.lostnfound.org</td>
<td>1989/9/29</td>
</tr>
<tr>
<td>carl@mountdev.net</td>
<td>39096</td>
<td>941-964-5708</td>
<td>$1788.11</td>
<td>http://www.samba.org</td>
<td>1983/2/7</td>
</tr>
<tr>
<td>sam@dn.se</td>
<td>45043</td>
<td>941-964-7175</td>
<td>$1254.08</td>
<td>http://google.se</td>
<td>1981/3/30</td>
</tr>
<tr>
<td>henry@dotnet.ca</td>
<td>41456</td>
<td>941-964-4812</td>
<td>$1779.17</td>
<td>http://mountdev.net</td>
<td>1980/9/11</td>
</tr>
<tr>
<td>christian@polyester.se</td>
<td>78584</td>
<td>941-964-6967</td>
<td>$3956.45</td>
<td>http://www.reno.gov</td>
<td>1982/7/24</td>
</tr>
<tr>
<td>muffins@flexomat.com</td>
<td>56098</td>
<td>941-964-9399</td>
<td>$558.88</td>
<td>http://www.fish.org</td>
<td>1981/3/1</td>
</tr>
<tr>
<td>muffins@gmail.com</td>
<td>92303</td>
<td>941-964-1958</td>
<td>$1094.38</td>
<td>http://www.fish.org</td>
<td>1983/1/10</td>
</tr>
<tr>
<td>christian@mountdev.net</td>
<td>96564</td>
<td>941-964-3947</td>
<td>$3593.94</td>
<td>http://www.dn.se</td>
<td>2004/11/26</td>
</tr>
<tr>
<td>lost@polyester.se</td>
<td>53352</td>
<td>941-964-7300</td>
<td>$1548.49</td>
<td>http://www.mountdev.net</td>
<td>1989/7/22</td>
</tr>
<tr>
<td>adam@flexomat.com</td>
<td>17411</td>
<td>941-964-6808</td>
<td>$3744.57</td>
<td>http://www.lostnfound.org</td>
<td>1998/4/17</td>
</tr>
<tr>
<td>john@gmail.com</td>
<td>55140</td>
<td>941-964-5592</td>
<td>$641.84</td>
<td>http://www.dn.se</td>
<td>1989/12/15</td>
</tr>
<tr>
<td>foo@google.se</td>
<td>19355</td>
<td>941-964-5290</td>
<td>$3053.28</td>
<td>http://donuts.com</td>
<td>1987/6/25</td>
</tr>
<tr>
<td>dev@dn.se</td>
<td>38729</td>
<td>941-964-1565</td>
<td>$1539.30</td>
<td>http://www.flexomat.com</td>
<td>1989/3/13</td>
</tr>
<tr>
<td>mendez@dn.se</td>
<td>22531</td>
<td>941-964-4285</td>
<td>$18.39</td>
<td>http://google.se</td>
<td>1996/8/19</td>
</tr>
<tr>
<td>found@mountdev.net</td>
<td>03979</td>
<td>941-964-3119</td>
<td>$2961.55</td>
<td>http://www.dotnet.ca</td>
<td>2005/5/27</td>
</tr>
<tr>
<td>foo@reno.gov</td>
<td>59240</td>
<td>941-964-3593</td>
<td>$3039.37</td>
<td>http://www.lostnfound.org</td>
<td>2005/8/27</td>
</tr>
<tr>
<td>dev@polyester.se</td>
<td>53160</td>
<td>941-964-8179</td>
<td>$468.97</td>
<td>http://www.samba.org</td>
<td>1988/10/23</td>
</tr>
<tr>
<td>christian@reno.gov</td>
<td>96671</td>
<td>941-964-99</td>
<td>$994.56</td>
<td>http://gmail.com</td>
<td>1984/4/22</td>
</tr>
<tr>
<td>christian@gmail.com</td>
<td>60247</td>
<td>941-964-341</td>
<td>$1358.07</td>
<td>http://www.donuts.com</td>
<td>1987/11/20</td>
</tr>
<tr>
<td>lost@dotnet.ca</td>
<td>92437</td>
<td>941-964-6495</td>
<td>$3384.20</td>
<td>http://mountdev.net</td>
<td>1982/10/14</td>
</tr>
<tr>
<td>dev@flexomat.com</td>
<td>08314</td>
<td>941-964-5549</td>
<td>$223.00</td>
<td>http://flexomat.com</td>
<td>1985/12/6</td>
</tr>
<tr>
<td>henry@lostnfound.org</td>
<td>46306</td>
<td>941-964-8496</td>
<td>$3170.19</td>
<td>http://www.dotnet.ca</td>
<td>1986/7/7</td>
</tr>
<tr>
<td>foo@mountdev.net</td>
<td>07328</td>
<td>941-964-3503</td>
<td>$2486.92</td>
<td>http://www.dn.se</td>
<td>1999/7/24</td>
</tr>
<tr>
<td>lost@flexomat.com</td>
<td>66996</td>
<td>941-964-5705</td>
<td>$3333.71</td>
<td>http://www.aftonbladet.se</td>
<td>1989/1/17</td>
</tr>
<tr>
<td>henry@donuts.com</td>
<td>83394</td>
<td>941-964-3776</td>
<td>$1808.67</td>
<td>http://dn.se</td>
<td>1981/6/14</td>
</tr>
<tr>
<td>muffins@fish.org</td>
<td>76935</td>
<td>941-964-5150</td>
<td>$403.02</td>
<td>http://www.samba.org</td>
<td>1986/7/13</td>
</tr>
</tbody>
</table>
</table>

View file

@ -1,8 +1,11 @@
<script>
var config = document.querySelectorAll('script[data-config]')[0];
var configs = document.querySelectorAll('script[data-config]');
var pre = document.body.getElementsByTagName('pre')[0];
if(pre && config){
pre.innerHTML = config.innerHTML
.replace('<', '&lt;').replace('>', '&gt;');
}
[].forEach.call(configs, function(config) {
if(pre){
pre.innerHTML +=
config.innerHTML.replace('<', '&lt;').replace('>', '&gt;');
}
});
</script>

View file

@ -2,11 +2,12 @@
<style type="text/css">
body{
font-family: Helvetica, arial, nimbussansl, liberationsans, freesans,
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol"
clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
padding: 1em;
}
pre{
margin: auto 1em 1em 1em;
padding: 0 1em 0 0;
padding: 0 1em 1em 1em;
float: right;
line-height: 1.45;
background-color: #F7F7F7;

View file

@ -8,17 +8,16 @@
<h1>{NAME} v{VERSION}</h1>
<h2>Data types demo</h2>
<p>In this example, 3 date types are used and numeric data for currency columns
is formated differently: </p>
<p>This example features 3 date types and 2 numeric formatting for the currency
columns:</p>
<ul>
<li>"." thousands separator and "," decimal separator for &euro;</li>
<li>"," thousands separator and "." decimal separator for US$</li>
</ul>
<p>
Use <code>col_number_format</code> property to set numeric formats
('EU', 'US' or 'IPADDRESS') for columns and <code>col_date_type</code> to
set date types.
Use the <code>col_number_format</code> property to set numeric formats
('EU', 'US' or 'IPADDRESS') and <code>col_date_type</code> to set date
types.
</p>
<!-- @import partials/pre.html -->
@ -26,98 +25,125 @@
<!-- @import partials/tablefilter-script.html -->
<script data-config>
var id = function (id){
return document.getElementById(id);
};
var table = id('demo-tot');
var totRowIndex = table.getElementsByTagName('tr').length;
var id = function (id){
return document.getElementById(id);
};
var table = id('demo-tot');
var totRowIndex = table.getElementsByTagName('tr').length;
var filtersConfig = {
base_path: '../dist/tablefilter/',
filters_row_index: 1,
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
col_number_format: [
null, null, null,
'EU', 'US', null,
null, null, null,
'IpAddress'
],
col_date_type: [
null, null, null,
null, null, null,
'dmy', 'mdy', 'ddmmmyyyy',
null
],
rows_always_visible: [totRowIndex],
on_filters_loaded: function(o){
o.setFilterValue(3, '>1.000');
o.setFilterValue(4, '<2,500');
o.setFilterValue(6, '>23-01-95');
o.filter();
},
extensions:[
{
name: 'sort',
types: [
'number', 'string', 'string',
'US', 'none', 'string'
]
},{
name: 'colOps',
id: ["sum1", "sum2"],
col: [3, 4],
operation: ["sum", "sum"],
write_method: ["innerhtml", 'innerhtml'],
exclude_row: [totRowIndex],
decimal_precision: [2, 2],
tot_row_index: [totRowIndex],
on_after_operation: formatTotals
}
]
};
function addCommas(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return x1 + x2;
}
var tf = new TableFilter('demo-tot', filtersConfig);
tf.init();
function addDots(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? ',' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '.' + '$2');
}
return x1 + x2;
}
function addCommas(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
function formatTotals(){
var tot1 = id('sum1').innerHTML;
tot1 = addDots(tot1);
id('sum1').innerHTML = tot1;
var tot2 = id('sum2').innerHTML;
tot2 = addCommas(tot2);
id('sum2').innerHTML = tot2;
}
/* EXAMPLE 1
*********************** */
var tfConfig = {
base_path: '../dist/tablefilter/',
filters_row_index: 1,
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
col_number_format: [
null, null, null,
'EU', 'US', null,
null, null, null,
'IpAddress'
],
col_date_type: [
null, null, null,
null, null, null,
'dmy', 'mdy', 'ddmmmyyyy',
null
],
rows_always_visible: [totRowIndex],
on_filters_loaded: function(o){
o.setFilterValue(3, '>1.000');
o.setFilterValue(4, '<2,500');
o.setFilterValue(6, '>23-01-95');
o.filter();
},
extensions:[
{
name: 'sort',
types: [
'number', 'string', 'string',
'US', 'none', 'string'
]
},{
name: 'colOps',
id: ["sum1", "sum2"],
col: [3, 4],
operation: ["sum", "sum"],
write_method: ["innerhtml", 'innerhtml'],
exclude_row: [totRowIndex],
decimal_precision: [2, 2],
tot_row_index: [totRowIndex],
on_after_operation: formatTotals
}
return x1 + x2;
}
]
};
function addDots(nStr){
nStr += '';
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? ',' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '.' + '$2');
}
return x1 + x2;
}
function formatTotals(){
var tot1 = id('sum1').innerHTML;
tot1 = addDots(tot1);
id('sum1').innerHTML = tot1;
var tot2 = id('sum2').innerHTML;
tot2 = addCommas(tot2);
id('sum2').innerHTML = tot2;
}
var tf = new TableFilter('demo-tot', tfConfig);
tf.init();
</script>
<p>Below an example of ISO date support (YMD). Use <code>default_date_type</code>
to set a date type for a whole table ('DMY','MDY','YMD').</p>
<!-- @import partials/dummy-table.html -->
<script data-config>
/* EXAMPLE 2
*********************** */
var tf2Config = {
base_path: '../dist/tablefilter/',
alternate_rows: true,
rows_counter: true,
btn_reset: true,
loader: true,
status_bar: true,
default_date_type: 'YMD',
on_filters_loaded: function(o){
o.setFilterValue(5, '>95-05-18');
o.filter();
}
};
var tf2 = new TableFilter('demo', tf2Config);
tf2.init();
</script>
<!-- @import partials/pre-inline-script.html -->
</body>
</html>

View file

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{NAME} v{VERSION} - Linked filters Demo</title>
<!-- @import partials/style.html -->
</head>
<body>
<h1>{NAME} v{VERSION}</h1>
<h2>Linked filters with disabled options demo</h2>
<p>
This demo features the refresh filters behaviour. In this mode, the
drop-down filters are linked and if the
<code>disable_excluded_options</code> is enabled, the invalid options in the
linked filters are simply greyed-out.
</p>
<p>
This feature was suggested by
<a href="http://www.zehnplus.ch" target="_blank">zehnplus</a>.
</p>
<!-- @import partials/pre.html -->
<!-- @import partials/countries-by-continent.html -->
<!-- @import partials/tablefilter-script.html -->
<script data-config>
var filtersConfig = {
base_path: '../dist/tablefilter/',
linked_filters: true,
disable_excluded_options: true,
col_1: 'multiple',
col_2: 'checklist',
col_widths: [
'60px', '160px', '160px',
'85px', '70px', '270px'
],
btn_reset: true,
display_all_text: '< Clear >',
alternate_rows: true,
rows_counter: true,
enable_default_theme: true,
extensions:[{
name: 'sort',
types: [
'number', 'string', 'string',
'US', 'none', 'string'
]
}]
};
var tf = new TableFilter('demo', filtersConfig);
tf.init();
</script>
<!-- @import partials/pre-inline-script.html -->
</body>
</html>

View file

@ -11,7 +11,7 @@
module('Sanity checks');
test('Linked filters feature', function() {
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(tf instanceof TableFilter, true, 'TableFilter instantiated');
deepEqual(tf.linkedFilters, true, 'Linked filters enabled');
});
@ -22,14 +22,29 @@
test('Check filters are linked', function() {
var filter0 = tf.getFilterElement(0);
deepEqual(tf.activeFilterId, 'flt1_demo_1', 'Active filter');
deepEqual(
filter0.options.length,
2,
deepEqual(filter0.options.length, 2,
'Linked filter expected options number'
);
});
tf.destroy();
tf = null;
setExcludedOptions();
}
function setExcludedOptions(){
tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/',
linked_filters: true,
disable_excluded_options: true,
col_0: 'multiple',
col_1: 'checklist',
on_after_filter: testExcludedOptions
});
tf.init();
}
function testExcludedOptions(tf){
}
})(window, TableFilter);

View file

@ -115,4 +115,6 @@ test('Set results per page', function() {
paging.changeResultsPerPage();
deepEqual(paging.pagingLength, 6, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages');
tf.destroy();
});