1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-07 08:56:41 +02:00
TableFilter/examples/old/requirejs.html
2015-06-13 23:53:28 +10:00

193 lines
7.6 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>HTML Table Filter Generator</title>
<script type="text/javascript">
var tf;
</script>
<style>
.test{ color: red !important; }
</style>
</head>
<body>
<p align="right">
<input type="button" value="Remove grid" onclick="tf.remove();" />
<input type="button" value="Reset grid" onclick="tf.init();" />
<input type="button" value="Reset paging"
onclick="
if( tf.paging ) return;
tf.Cpt.paging.addPaging();" >
<input type="button" value="Remove paging"
onclick="
if( !tf.paging ) return;
tf.paging = false; //behaviour is removed here
tf.Cpt.paging.destroy();
tf.filter();" >
</p>
<div id="test_cont">sss</div>
<div style="width: 500px;">
<table id="demo" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>From</th>
<th>Destination</th>
<th>Road Distance (km)</th>
<th>By Air (hrs)</th>
<th>By Rail (hrs)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>Sydney</strong></td>
<td>Adelaide</td>
<td>1412</td>
<td>1.4</td>
<td>25.3</td>
</tr>
<tr>
<td><strong>Sydney</strong></td>
<td>Brisbane</td>
<td>982</td>
<td>1.5</td>
<td>16</td>
</tr>
<tr>
<td><strong>Sydney</strong></td>
<td>Canberra</td>
<td>286</td>
<td>.6</td>
<td>4.3</td>
</tr>
<tr>
<td><strong>Sydney</strong></td>
<td>Melbourne</td>
<td>872</td>
<td>1.1</td>
<td>10.5</td>
</tr>
<tr>
<td><strong>Adelaide</strong></td>
<td>Perth</td>
<td>2781</td>
<td>3.1</td>
<td>38</td>
</tr>
<tr>
<td><strong>Adelaide</strong></td>
<td>Alice Springs</td>
<td>1533</td>
<td>2</td>
<td>20.25</td>
</tr>
<tr>
<td><strong>Adelaide</strong></td>
<td>Brisbane</td>
<td>2045</td>
<td>2.15</td>
<td>40</td>
</tr>
</tbody>
</table>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.min.js"></script>
<!-- <script src="../libs/sortabletable.js"></script> -->
<script>
requirejs(['../build/tablefilter/tablefilter', '../libs/sortabletable'], function(mod){
var TableFilter = mod.TableFilter;
tf = new TableFilter("demo", {
col_0: 'select',
col_2: 'multiple',
col_3: 'checklist',
base_path: '../build/tablefilter/',
loader: false,
rows_counter: true,
enable_default_theme: false,
// slc_filling_method: 'innerhtml',
sort: true,
sort_config: {
path: '../build/tablefilter/extensions/sort/',
sort_types: ['string','string','number','number','number']
},
paging: false,
paging_length: 4,
// page_selector_type: 'input',
//results_per_page: ['Results per page', [2,4,6]],
remember_grid_values: true,
// remember_page_number: true,
// remember_page_length: true,
fill_slc_on_demand: false,
linked_filters: false,
popup_filters: false,
alternate_rows: true,
highlight_keywords: true,
match_case: false,
btn_reset: true,
status_bar: true,
watermark: [null, 'Filter column...', null, null, 'Helo'],
selectable: false,
editable: false,
ezEditTable_config:{
default_selection: 'both',
loadStylesheet: true
},
grid_layout: true,
grid_width: '600px',
// grid_height: '200px',
on_before_show_msg: function(tf){
// console.log('on_before_show_msg');
},
extensions: [{
name: 'advancedGrid',
path: '../build/tablefilter/extensions/advancedGrid/',
vendor_path: '../libs/ezEditTable/',
selectable: true,
editable: true,
default_selection: 'both',
auto_save: false
},{
/*** Columns Visibility Manager extension load ***/
name: 'colsVisibility',
path: '../build/tablefilter/extensions/colsVisibility/',
description: 'Columns visibility manager',/*
initialize: function(o){o.SetColsVisibility();}*/
// manager: true,
tick_to_hide: true,
// headers_table: true,
// container_target_id: 'test_cont',
// headers_text: ['1','2','3','4','5','6'],
btn_target_id: 'test_cont',
// btn_text: 'Hola',
// btn_html: '<button>Columns</button>',
// btn_css_class: 'test',
// btn_close_text: 'jj',
// btn_close_html: '<button>close</button>',
// btn_close_css_class: 'test',
// stylesheet: 'hola.css',
// cont_css_class: 'test',
// checklist_item_css_class: 'test',
// at_start: [0,1,2,3,4],
// enable_hover: true,
enable_tick_all: true
// ,
// tick_all_text: 'Hola',
// text: 'tutu',
// on_loaded: function(){ console.log(arguments); },
// on_before_open: function(){ console.log('on_before_open', arguments); },
// on_after_open: function(){ console.log('on_after_open',arguments); },
// on_before_close: function(){ console.log('on_before_close',arguments); },
// on_after_close: function(){ console.log('on_after_close',arguments); },
// on_before_col_hidden: function(){ console.log('on_before_col_hidden',arguments); },
// on_after_col_hidden: function(){ console.log('on_after_col_hidden',arguments); },
// on_before_col_displayed: function(){ console.log('on_before_col_displayed',arguments); },
// on_after_col_displayed: function(){ console.log('on_after_col_displayed',arguments); }
}]
});
tf.init();
});
</script>
<button onclick="javascript:tf.ExtRegistry.colsVisibility.toggleCol(2);">Toggle col 2</button>
</body>
</html>