<html>
<head>
	<title>Tabulator - Live Demo</title>

	<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
	<link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
	<link rel="stylesheet" href="tabulator.css">

	<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
	<script type="text/javascript" src="https://code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
	<script type="text/javascript" src="tabulator.js"></script>
</head>
<body>

	<style type="text/css">
		body{
			padding:20px 40px;
			font-family: 'Montserrat', sans-serif !important;
		}

		header{
			font-weight: bold;
			font-size: 30px;
		}

		header span{
			vertical-align: middle;
			font-size: .5em;
			color: #999;
		}

		header span a{
			font-size: .9em;
		}

		section:first-of-type header{
			font-size: 50px;
		}

		section{
			margin-bottom:30px;
		}

		ul>li{
			margin-bottom:2px;
		}

		button, select{
			margin-right:20px;
		}

		input{
			font-family: 'Montserrat', sans-serif !important;

		}
	</style>

	<script type="text/javascript">

	//sample data to be used in all tabulators
	var tabledata = [
	{id:1, name:"Oli Bob \n steve", age:"12", gender:"male", height:1, col:"red", dob:"", cheese:1, lucky_no:5},
	{id:2, name:"Mary May", age:"1", gender:"female", height:2, col:"blue", dob:"14/05/1982", cheese:true, lucky_no:10},
	{id:3, name:"Christine Lobowski", age:"42", height:0, col:"green", dob:"22/05/1982", cheese:"true", lucky_no:12},
	{id:4, name:"Brendon Philips", age:"125", gender:"male", height:1, col:"orange", dob:"01/08/1980", lucky_no:18},
	{id:5, name:"Margret Marmajuke", age:"16", gender:"female", height:5, col:"yellow", dob:"31/01/1999", lucky_no:33},
	{id:6, name:"Frank Harbours", age:"38", gender:"male", height:4, col:"red", dob:"", cheese:1, lucky_no:2},
	{id:7, name:"Jamie Newhart", age:"23", gender:"male", height:3, col:"green", dob:"14/05/1985", cheese:true, lucky_no:63},
	{id:8, name:"Gemma Jane", age:"60", height:0, col:"red", dob:"22/05/1982", cheese:"true", lucky_no:72},
	{id:9, name:"Emily Sykes", age:"42", gender:"female", height:1, col:"maroon", dob:"11/11/1970", lucky_no:44},
	{id:10, name:"James Newman", age:"73", gender:"male", height:5, col:"red", dob:"22/03/1998", lucky_no:9},
	];

</script>

<section>
	<header>Tabulator</header>

	<p>An easy to use table generation JQuery UI Plugin</p>

	<p>Tabulator allows you to create  a table with in seconds from any JSON formatted data.</p>

	<p>It relies on no external css or images, simply include the library in your JQuery UI project and you're away!</p>

	<p>Tabulator is packed with useful features including:
		<ul>
			<li>JSON, array or AJAX data loading</li>
			<li>Column sorting</li>
			<li>Custom data formatting</li>
			<li>Resizable columns</li>
			<li>Auto scaling  to fit data/element</li>
			<li>Many theming options</li>
			<li>Custom click and context Events</li>
			<li>Callbacks at every stage of data processing and rendering</li>
		</ul>
	</p>
	<div id="example-table-demo"></div>
	<script type="text/javascript">

		var printIcon = function(value, data, cell, row, options){ //plain text value
			return "<i class='fa fa-print' style='vertical-align:middle; padding:2px 0;'></i> "
		};

		$("#example-table-demo").tabulator({
			height:"320px",
			fitColumns:true,
			tooltips:true,
			tooltipsHeader:true,
			movableCols:true,
			columns:[
			{formatter:printIcon, width:40, align:"center",onClick:function(e, cell, val, data){alert("Printing row data for: " + data.name)} },
			{title:"Name", field:"name", sorter:"string", width:150, tooltipHeader:"Custom Header Tooltip"},
			{title:"Age", field:"age", sorter:"number", align:"left", formatter:"progress"},
			{title:"Gender", field:"gender", width:100, sorter:"string", onClick:function(e, val, cell, data){console.log("cell click - " + val, cell)}},
			{title:"Height", field:"height", formatter:"star", align:"center", sorter:"number", width:100},
			{title:"Favourite Color", field:"col", sorter:"string", sortable:false},
			{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross", sorter:"boolean"},
			],
			rowClick:function(e, id, data, row){
				alert("Row " + id + " Clicked!!!!")
			},
			rowContext:function(e, id, data, row){
				alert("Row " + id + " Context Clicked!!!!")
			},
		});

		$("#example-table-demo").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-demo").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Simple Table</header>
	<p>
		In its simplest form, all you need to set in the options are the column titles and field names.
	</p>
	<p>
		By default columns are resizable (using edge of column header) and sortable (as strings).
	</P>
	<div id="example-table-simple"></div>
	<script type="text/javascript">

		$("#example-table-simple").tabulator({
			height:"320px",
			data:tabledata,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", width:60, sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", width:80},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob"},
			{title:"Likes Cheese", field:"cheese"},
			],
		});

		$(window).resize(function(){
			$("#example-table-simple").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Fit To Data <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#fittodata">http://olifolkerd.github.io/tabulator/docs/#fittodata</a></span></header>
	<p>
		Tables will automatically resize to fit the data
	</p>
	<div id="example-table-fittodata"></div>
	<script type="text/javascript">

		$("#example-table-fittodata").tabulator({
			height:"320px",
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", width:60, align:"right", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", align:"center", width:80},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center"},
			],
		});

		$("#example-table-fittodata").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-fittodata").tabulator("redraw");
		});

	</script>
</section>


<section>
	<header>Fit To Width <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#fittowidth">http://olifolkerd.github.io/tabulator/docs/#fittowidth</a></span></header>
	<p>
		By setting the <span><strong>fitColumns</strong></span> to true, the table will resize columns so that they fit perfectly inside the width of the container.
	</p>
	<p>
		If a width is specified on any columns, where possible the columns will be set at this width and other columns will be resized around them. If there is not enough space to fit all the columns in, then all column widths are ignored and they are sized equally.
	</p>
	<div id="example-table-fittowidth"></div>
	<script type="text/javascript">
		$("#example-table-fittowidth").tabulator({
			height:"320px",
			fitColumns:true,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", align:"right", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", align:"center", width:60},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center"},
			],
		});

		$("#example-table-fittowidth").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-fittowidth").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Parse Data from Table Element</header>

	<p>It is possible to turn a standard HTML Table element into a tabulator, pulling all the data directly from the table into the tabulator when it is created.</p>

	<table id="example-table-table">
		<thead>
			<tr>
				<th width="200">Name</th>
				<th>Age</th>
				<th>Gender</th>
				<th>Height</th>
				<th>Favourite Color</th>
				<th>Date of Birth</th>
				<th>Likes Cheese</th>
			</tr>
		</thead>
		<tbody>
			<tr>
				<td>Oli Bob</td>
				<td>12</td>
				<td>male</td>
				<td>1</td>
				<td>red</td>
				<td></td>
				<td>1</td>
			</tr>
			<tr>
				<td>Mary May</td>
				<td>1</td>
				<td>female</td>
				<td>2</td>
				<td>blue</td>
				<td>14/05/1982</td>
				<td>true</td>
			</tr>
		</tbody>
	</table>

	<script type="text/javascript">
		$("#example-table-table").tabulator({});
	</script>
</section>

<section>
	<header>Editable Data <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#manipulating-data">http://olifolkerd.github.io/tabulator/docs/#manipulating-data</a></span></header>
	<p>
		Using the <strong>editable</strong> setting on each column, you can make a user editable table.
	</p>
	<p>
		Any time a cell is edited it triggers the <strong>rowEdit</strong> callback, to allow you to process any changes.
	</p>
	<p>
		You can call the <strong>getData</strong> method to get an array of all of the tables data, including any edits
	</p>
	<div id="example-table-editable"></div>
	<script type="text/javascript">

	//custom editor
	var genderEditor = function(cell, value){
		//cell - JQuery object for current cell
		//value - the current value for current cell

		//create and style editor
		var editor = $("<select><option value=''></option><option value='male'>male</option><option value='female'>female</option></select>");
		editor.css({
			"padding":"4px",
			"width":"100%",
			"box-sizing":"border-box",
		})

		//Set value of editor to the value of the cell
		.val(value);

		//set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM)
		setTimeout(function(){
			editor.focus();
		},100)

		//when the value has been set, update the cell
		editor.on("change blur", function(e){
			cell.trigger("editval", editor.val());
		});

		//return the editor element
		return editor;
	}

	$("#example-table-editable").tabulator({
		height:"320px",
		columns:[
		{title:"Name", field:"name", width:200, editable:true, editable:true},
		{title:"Age", field:"age", sorter:"number", align:"left", formatter:"progress", width:200,  editable:true},
		{title:"Gender", field:"gender", editable:true, editor:genderEditor},
		{title:"Height", field:"height",  formatter:"star", align:"center", width:100, editable:true},
		{title:"Favourite Color", field:"col", editable:true},
		{title:"Date Of Birth", field:"dob", align:"center", sorter:"date", editable:true},
		{title:"Likes Cheese", field:"cheese", align:"center", editable:true, formatter:"tickCross"},
		{title:"Luck No", field:"lucky_no", align:"right", width:100, sorter:"number", editor:"number"},

		],
		rowEdit:function(id,data,row){

		},
	});

	$("#example-table-editable").tabulator("setData", tabledata);

	$(window).resize(function(){
		$("#example-table-editable").tabulator("redraw");
	});

</script>
</section>

<section>
	<header>Sorters <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#sorting">http://olifolkerd.github.io/tabulator/docs/#sorting</a></span></header>
	<p>Sorting is enabled by default, and can be toggled on or off by column using the <span><strong>sortable</strong></span> option.</p>

	<p>By default all columns are sorted as text, different sort functions can be set using the <span><strong>sorter</strong></span> option

		<ul>
			<li><strong>string</strong> - sorts column as strings of characters</li>
			<li><strong>number</strong> - sorts column as numbers (integer or float, will also handle numbers using "," seperators)</li>
			<li><strong>alphanum</strong> - sorts column as alpha numeric code</li>
			<li><strong>boolean</strong> - sorts column as booleans</li>
			<li><strong>date</strong> - sorts column as dates (for this you will need to set the date format using the <span><strong>dateFormat</strong></span> option when you create your table. default format is "dd/mm/yyyy")</li>
		</ul>

	</p>

	<p>You can define a custom sorter functions in the sorter option if you need bespoke sorting functionality.</p>

	<p>You can programmatically trigger a sort using the <strong>sort</strong> function.</p>

	<p>
		<fieldset>
			<legend>Programmatic Sort</legend>

			<label>Field: </label>
			<select id="sort-field">
				<option value="name" selected>Name</option>
				<option value="age">Age</option>
				<option value="gender">Gender</option>
				<option value="height">Height</option>
				<option value="col">Favourite Colour</option>
				<option value="dob">Date Of Birth</option>
				<option value="cheese">Likes Cheese</option>
			</select>


			<label>Direction:</label>
			<select id="sort-direction">
				<option value="asc" selected>asc</option>
				<option value="desc">desc</option>
			</select>

			<input id="sort-trigger" type="button" value="Trigger Sort" style="margin-left:40px;">

		</fieldset>

	</p>

	<div id="example-table-sorting"></div>
	<script type="text/javascript">
		$("#example-table-sorting").tabulator({
			height:"320px",
			fitColumns:true,
			sortBy:"name",
			sortDir:"asc",
			columns:[
			{title:"Name", field:"name", sorter:"string", width:200},
			{title:"Age", field:"age", sorter:"number", align:"right", sorter:"number"},
			{title:"Gender", field:"gender", sorter:"string"},
			{title:"Height", field:"height",  align:"center", width:100},
			{title:"Favourite Color", field:"col", sortable:false, sorter:function(a,b){
				return String(a).toLowerCase().localeCompare(String(b).toLowerCase());
			}},
			{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
			{title:"Likes Cheese", field:"cheese", align:"center", sorter:"boolean"},
			],
		});

		$("#example-table-sorting").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-sorting").tabulator("redraw");
		});

		$("#sort-trigger").click(function(){
			$("#example-table-sorting").tabulator("sort", $("#sort-field").val(), $("#sort-direction").val());
		})


	</script>
</section>

<section>
	<header>Formatters <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#formatting">http://olifolkerd.github.io/tabulator/docs/#formatting</a></span></header>
	<p></p>
	<p>Tabulator allows you to format your data in a wide variety of ways, so your tables can display information in a more graphical and clear layout.</p>

	<p>you can set formatters on a per column basis using the <span><strong>formatter</strong></span> option in the column data.</p>

	<p>
		Tabulator comes with a number of preconfigured formatters including:
		<ul>
			<li><strong>money</strong> - formats a number into a currency notation (eg. 1234567.8901 -> 1,234,567.89)</li>
			<li><strong>email</strong> - renders data as an anchor with a mailto: link to the given value</li>
			<li><strong>link</strong> - renders data as an anchor with a link to the given value</li>
			<li><strong>tick</strong> - displays a green tick if the value is (true|'true'|'True'|1) and an empty cell if not</li>
			<li><strong>tickCross</strong> - displays a green tick if the value is (true|'true'|'True'|1) and a red cross if not</li>
			<li><strong>color</strong> - sets the background color of the cell to the value. Can be any valid css colour eg. #ff0000, #f00, rgb(255,0,0), red, rgba(255,0,0,0), hsl(0, 100%, 50%)</li>
			<li><strong>star</strong> - displays a graphical 0-5 star rating based on integer values from 0-5</li>
			<li><strong>progress</strong> - displays a progress bar that fills the cell from left to right, using values 0-100 as a percentage of width</li>
			<li><strong>buttonTick</strong> - displays a tick icon on eac row (for use as a button)</li>
			<li><strong>buttonCross</strong> - displays a cross icon on eac row (for use as a button)</li>
		</ul>
	</p>

	<p>You can define a custom formatter function in the formatter option if you need more bespoke formatter functionality</p>

	<p>You can create icon/button columns, by not specifying a field parameter in the column data and creating a custom formatter for the column contents. In the example below we have created a print button on the left of each row.</p>

	<p>You can also set a row formatter using the <strong>rowFormatter</strong> option, this allows you to format the styling of the row as a whole</p>

	<div id="example-table-formatter"></div>
	<script type="text/javascript">


		var printIcon = function(value, data, cell, row, options){ //plain text value
			return "<i class='fa fa-print'></i> "
		};

		$("#example-table-formatter").tabulator({
			height:"320px",
			fitColumns:true,
			rowFormatter:function(row, data){

				if(data.col == "blue"){
					row.css({"background-color":"#A6A6DF"});
				}
			},
			columns:[
			{formatter:printIcon, width:40, align:"center", onClick:function(e, cell, val, data){alert("Printing row data for: " + data.name)}},
			{title:"Name", field:"name", width:200, formatter:function(value, data, cell, row, options){
				if(value.indexOf("o") > 0){
					return "<span style='color:red; font-weight:bold;'>" + value + "</span>";
				}else{
					return value;
				}
			}},
			{title:"Age", field:"age", formatter:"progress", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", formatter:"star", formatterParams:{stars:6}, align:"center", width:120},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			{title:"Favourite Color", field:"col" ,formatter:"color", width:160},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{formatter:"buttonCross", width:30, align:"center"},
			],
		});

		$("#example-table-formatter").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-formatter").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Grouping Data <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#grouping">http://olifolkerd.github.io/tabulator/docs/#grouping</a></span></header>
	<p></p>
	<p>You can group rows together using the <strong>groupBy</strong> option. To group by a field, set this option to the name of the field.</p>
	<p>To group by more complex operations you should pass a function that returns a string that represents the group.</p>

	<div id="example-table-grouping"></div>
	<script type="text/javascript">


		var printIcon = function(value, data, cell, row, options){ //plain text value
			return "<i class='fa fa-print'></i> "
		};

		$("#example-table-grouping").tabulator({
			height:"320px",
			fitColumns:true,
			groupBy:"gender",
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", formatter:"progress", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			],
		});

		$("#example-table-grouping").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-grouping").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Filter Data <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#filtering">http://olifolkerd.github.io/tabulator/docs/#filtering</a></span></header>
	<p></p>
	<p>Tabulator allows you to filter the table data by any field in the data set.</p>

	<p>To set a filter you need to call the <strong>setFilter</strong> method, passing the field you wish to filter, the comparison type and the value to filter for</p>

	<p>
		Tabulator comes with a number of filter comparison types including:
		<ul>
			<li><strong>=</strong> - Displays only rows with data that is the same as the filter</li>
			<li><strong>&lt;</strong> - displays rows with a value less than the filter value</li>
			<li><strong>&lt;=</strong> - displays rows with a value less than or qual to the filter value</li>
			<li><strong>&gt;</strong> - displays rows with a value greater than the filter value</li>
			<li><strong>&gt;=</strong> - displays rows with a value greater than or qual to the filter value</li>
			<li><strong>!=</strong> - displays rows with a value that is not equal to the filter value</li>
			<li><strong>like</strong> - displays any rows with data that contains the specified string anywhere in the specified field. (case insesitive)</li>
		</ul>
	</p>

	<p>
		<fieldset>
			<legend>Filter Parameters</legend>


			<label>Field: </label>
			<select id="filter-field">
				<option></option>
				<option value="name">Name</option>
				<option value="age">Age</option>
				<option value="gender">Gender</option>
				<option value="height">Height</option>
				<option value="col">Favourite Colour</option>
				<option value="dob">Date Of Birth</option>
				<option value="cheese">Likes Cheese</option>
				<option value="function">Likes Cheese &amp; height &lt; 3</option>
			</select>


			<label>Type:</label>
			<select id="filter-type">
				<option value="=">=</option>
				<option value="<">&lt;</option>
				<option value="<=">&lt;=</option>
				<option value=">">&gt;</option>
				<option value=">=">&gt;=</option>
				<option value="!=">!=</option>
				<option value="like">like</option>
			</select>


			<label>Value: </label><input id="filter-value" type="text" placeholder="value to filter">

			<input id="filter-clear" type="button" value="Clear Filter" style="margin-left:40px;">

		</fieldset>

	</p>

	<div id="example-table-filters"></div>
	<script type="text/javascript">

		function customFilter(data){
			return data.cheese && data.height < 3;
		}

		function updateFilter(){

			var filter = $("#filter-field").val() == "function" ? customFilter : $("#filter-field").val();

			if($("#filter-field").val() == "function" ){
				$("#filter-type").prop("disabled", true);
				$("#filter-value").prop("disabled", true);
			}else{
				$("#filter-type").prop("disabled", false);
				$("#filter-value").prop("disabled", false);
			}

			$("#example-table-filters").tabulator("setFilter", filter, $("#filter-type").val(), $("#filter-value").val());
		}

		$("#filter-field, #filter-type").change(updateFilter);
		$("#filter-value").keyup(updateFilter);

		$("#filter-clear").click(function(){
			$("#filter-field").val("");
			$("#filter-type").val("=");
			$("#filter-value").val("");

			$("#example-table-filters").tabulator("clearFilter");
		});



		$("#example-table-filters").tabulator({
			height:"320px",
			fitColumns:true,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", formatter:"progress", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			],
		});

		$("#example-table-filters").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-filters").tabulator("redraw");
		});

	</script>
</section>


<section>
	<header>Pagination<span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#pagination">http://olifolkerd.github.io/tabulator/docs/#pagination</a></span></header>

	<p>Tabulator allows you to paginate your data. simply set the <strong>pagination</strong> property to true.</p>

	<p>If you have set the height of the table then the data will be automatically paginated to fit within the table.</p>

	<p>If you wish to define how many rows should be shown on a page, set this in the <strong>paginationSize</strong> property. If you set the paginationSize without setting the height, the Tabulator will automatically resize to fit the data</p>

	<div id="example-table-pagination"></div>
	<script type="text/javascript">


		var printIcon = function(value, data, cell, row, options){ //plain text value
			return "<i class='fa fa-print'></i> "
		};

		$("#example-table-pagination").tabulator({
			height:"166px",
			fitColumns:true,
			pagination:true,
			// paginationSize:4,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", formatter:"progress", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			],
		});

		$("#example-table-pagination").tabulator("setData", tabledata);

		$("#example-table-pagination").tabulator("setPage", 1);

		$(window).resize(function(){
			$("#example-table-pagination").tabulator("redraw");
		});

	</script>
</section>


<section>
	<header>Persistent Column Layout <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#persistant-columns">http://olifolkerd.github.io/tabulator/docs/#persistant-columns</a></span></header>
	<p>
		Tabulator can store the layout of columns in a cookie so that each time a user comes back to the page the table is laid out just as they left it.
	</p>
	<p>
		Try resizing (drag the right edge of a column header) or rearranging (drag the middle of a column header) the columns of this table, then refresh the page. your new layout will persist.
	</P>
	<div id="example-table-colum-layout"></div>
	<script type="text/javascript">

		$("#example-table-colum-layout").tabulator({
			height:"320px",
			movableCols:true,
			columnLayoutCookie: true,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", width:60, sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", width:80},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			],
		});

		$("#example-table-colum-layout").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-colum-layout").tabulator("redraw");
		});

	</script>
</section>


<section>
	<header>AJAX Data Loading <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#ajax">http://olifolkerd.github.io/tabulator/docs/#ajax</a></span></header>
	<p>Data can be loaded into the table from a remote URL using a JSON formatted string.</p>

	<p>If you always request the same URL for your data then you can set it in the <span><strong>ajaxURL</strong></span> option when you create your Tabulator</p>

	<p>Click the button below to load sample data via AJAX (you will need PHP enabled on your webserver for this to work).</p>
	<p><input id="ajax-trigger" type="button" value="Load Data via AJAX"></p>
	<div id="example-table-ajax"></div>
	<script type="text/javascript">
		$("#example-table-ajax").tabulator({
			height:"320px",
			fitColumns:true,
			ajaxURL:"/ajax_sim.php",
			columns:[
			{title:"Name", field:"name", sorter:"string", width:200},
			{title:"Age", field:"age", sorter:"number", align:"right", formatter:"progress"},
			{title:"Gender", field:"gender", sorter:"string"},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col", sorter:"string", sortable:false},
			{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross", sorter:"boolean"},
			],
		});

		$("#ajax-trigger").click(function(){
			$("#example-table-ajax").tabulator("setData");
		})

		$(window).resize(function(){
			$("#example-table-ajax").tabulator("redraw");
		});

	</script>
</section>

<section>
	<header>Add / Delete Rows & Columns <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#addrow">http://olifolkerd.github.io/tabulator/docs/#addrow</a></span></header>
	<p>
		Tablulator allows you to add new rows and columns, delete existing rows and columns, and clear all table data with ease.
	</p>
	<p>
		<button id="add-col">Add "Favourite Color" Column</button>
		<button id="del-col">Remove "Date Of Birth" Column</button>
		<button id="add-row">Add Blank Row to bottom of table</button>
		<button id="del-row">Remove "Oli Bob" From the table</button>
		<button id="clear">Empty the table</button>
		<button id="reset">Reset the table</button>
	</p>
	<div id="example-table-adddel"></div>
	<script type="text/javascript">

		$("#add-col").click(function(){
			$("#example-table-adddel").tabulator("addColumn",  {title:"Favourite Color", field:"col", editable:true}, true, "height");
		})

		$("#del-col").click(function(){
			$("#example-table-adddel").tabulator("deleteColumn", "dob");
		})

		$("#add-row").click(function(){
			$("#example-table-adddel").tabulator("addRow");
		})

		$("#del-row").click(function(){
			$("#example-table-adddel").tabulator("deleteRow", 1);
		})

		$("#clear").click(function(){
			$("#example-table-adddel").tabulator("clear");
		})

		$("#reset").click(function(){
			$("#example-table-adddel").tabulator("setData", tabledata);
		})



		$("#example-table-adddel").tabulator({
			height:"320px",
			addRowPos:"bottom",
			columns:[
			{title:"Name", field:"name", width:200, editable:true},
			{title:"Age", field:"age", width:90, align:"right", sorter:"number", editable:true},
			{title:"Gender", field:"gender", editable:true},
			{title:"Height", field:"height", align:"center", width:80, editable:true},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date", editable:true},
			{title:"Likes Cheese", field:"cheese", align:"center", editable:true},
			],
			rowEdit:function(id,data,row,index){

			}
		});

		$("#example-table-adddel").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-adddel").tabulator("redraw");
		});

	</script>
</section>


<section>
	<header>Movable Rows <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#movable">http://olifolkerd.github.io/tabulator/docs/#movable</a></span></header>
	<p>
		Using the <strong>movableRows</strong> parameter you can allow the user to move rows around the table using the handle on the left-hand side of the row.
	</p>
	<div id="example-table-movable-rows"></div>
	<script type="text/javascript">

		$("#example-table-movable-rows").tabulator({
			height:"320px",
			movableRows:true,
			columns:[
			{title:"Name", field:"name", width:200},
			{title:"Age", field:"age", formatter:"progress", sorter:"number"},
			{title:"Gender", field:"gender"},
			{title:"Height", field:"height", formatter:"star", formatterParams:{stars:6}, align:"center", width:120},
			{title:"Favourite Color", field:"col"},
			{title:"Date Of Birth", field:"dob", align:"center", sorter:"date"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross"},
			],
			rowMoved:function(id,data,row,index){
				alert("Row: " + data.name + " has been moved to position " + index)
			}
		});

		$("#example-table-movable-rows").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-movable-rows").tabulator("redraw");
		});

	</script>
</section>



<section>
	<header>Callbacks <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#callbacks">http://olifolkerd.github.io/tabulator/docs/#callbacks</a></span></header>
	<p>Tabulator features a range of callbacks to allow you to handle user interaction.</p>

	<ul>
		<li><strong>Cell Click</strong> - The cell click callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the <span><strong>onClick</strong></span> option in the columns data. (left click any cell in the gender column in this example)</li>
		<li><strong>Row Click</strong> - The row click callback is triggered when a user clicks on a row, it can be set globally, by setting the<span><strong>rowClick</strong></span>option when you create your Tabulator. (left click any row in this example)</li>
		<li><strong>Row Context Menu</strong> - The row context callback is triggered when a user right clicks on a row, it can be set globally, by setting the <span><strong>rowContext</strong></span> option when you create your Tabulator. (right click any row in this example)</li>
		<li><strong>Data Loaded</strong> - The data loaded callback is triggered when a new set of data is loaded into the table, it can be set globally, by setting the <span><strong>dataLoaded</strong></span> option when you create your</li>
	</ul>

	<div id="example-table-callbacks"></div>
	<script type="text/javascript">
		$("#example-table-callbacks").tabulator({
			height:"320px",
			fitColumns:true,
			columns:[
			{title:"Name", field:"name", sorter:"string", width:150},
			{title:"Age", field:"age", sorter:"number", align:"right", formatter:"progress"},
			{title:"Gender", field:"gender", width:100, sorter:"string", onClick:function(e, cell, val, data){alert("cell clicked - " + val)}},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col", sorter:"string", sortable:false},
			{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross", sorter:"boolean"},
			],
			rowClick:function(e, id, data, row){
				alert("Row " + id + " Clicked!!!!")
			},
			rowContext:function(e, id, data, row){
				alert("Row " + id + " Context Clicked!!!!")
			},
		});

		$("#example-table-callbacks").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-callbacks").tabulator("redraw");
		});

	</script>

</script>
</section>

<section>
	<header>Theming  <span> - for full documentation visit <a href="http://olifolkerd.github.io/tabulator/docs/#css">http://olifolkerd.github.io/tabulator/docs/#css</a></span></header>
	<p>Tabulator is styled using a full set of CSS classes, making theming of the table very simple, A full list of these can be found in the GitHub readme.md file</p>
	<div id="example-table-theme"></div>

	<style>
		/*Theme the table*/
		#example-table-theme{
			background-color:#ccc;
			border: 1px solid #333;
		}

		/*Theme the header*/
		#example-table-theme .tabulator-header {
			background-color:#333;
			color:#fff;
		}

		/*Theme the rows*/
		#example-table-theme .tabulator-tableHolder .tabulator-table .tabulator-row{
			color:#fff;
			background-color: #666;
		}

		#example-table-theme .tabulator-tableHolder .tabulator-table .tabulator-row:nth-child(even) {
			background-color: #444;
		}

	</style>


	<script type="text/javascript">
		$("#example-table-theme").tabulator({
			height:"320px",
			fitColumns:true,
			columns:[
			{title:"Name", field:"name", sorter:"string", width:150},
			{title:"Age", field:"age", sorter:"number", align:"right", formatter:"progress"},
			{title:"Gender", field:"gender", width:100, sorter:"string", onClick:function(e, cell, val, data){alert("cell clicked - " + val)}},
			{title:"Height", field:"height", formatter:"star", align:"center", width:100},
			{title:"Favourite Color", field:"col", sorter:"string", sortable:false},
			{title:"Date Of Birth", field:"dob", sorter:"date", align:"center"},
			{title:"Likes Cheese", field:"cheese", align:"center", formatter:"tickCross", sorter:"boolean"},
			],
			rowClick:function(e, id, data, row){
				alert("Row " + id + " Clicked!!!!")
			},
			rowContext:function(e, id, data, row){
				alert("Row " + id + " Context Clicked!!!!")
			},
		});

		$("#example-table-theme").tabulator("setData", tabledata);

		$(window).resize(function(){
			$("#example-table-theme").tabulator("redraw");
		});

	</script>
</section>

</body>
</html>
