The state component allows for a better user experience by remembering which page the user is on, the currently sorted column
and any search filters that have been applied. These values are persisted across browser sessions by using localStorage
.
See the showcase example to see this component in action. There is no UI so sort a column, change the page or apply a filter and then refresh the browser.
The below lists all the options for the state component, these are available in addition to the core options.
Whether or not the component is enabled.
false
By default this component is disabled, no UI or features of this component will be available.
To supply this option through data attributes you must specify the attribute on the table
element.
<table data-state="true">
...
</table>
The below shows how to supply the value directly through the options.
jQuery(function($){
$('.table').footable({
"state": {
"enabled": true
}
});
});
Whether or not to store the state of the filtering component.
true
By default the filtering state is stored when the component is enabled.
To supply this option through data attributes you must specify the attribute on the table
element.
<table data-state-filtering="false">
...
</table>
The below shows how to supply the value directly through the options.
jQuery(function($){
$('.table').footable({
"state": {
"filtering": false
}
});
});
Whether or not to store the state of the paging component.
true
By default the paging state is stored when the component is enabled.
To supply this option through data attributes you must specify the attribute on the table
element.
<table data-state-paging="false">
...
</table>
The below shows how to supply the value directly through the options.
jQuery(function($){
$('.table').footable({
"state": {
"paging": false
}
});
});
Whether or not to store the state of the sorting component.
true
By default the sorting state is stored when the component is enabled.
To supply this option through data attributes you must specify the attribute on the table
element.
<table data-state-sorting="false">
...
</table>
The below shows how to supply the value directly through the options.
jQuery(function($){
$('.table').footable({
"state": {
"sorting": false
}
});
});
The key used to store this tables state in localStorage.
null
The default of null means the plugin will generate a page and table specific identifier. By supplying a value you can persist state across different pages for the same table.
To supply this option through data attributes you must specify the attribute on the table
element.
<table data-state-key="YOUR_KEY">
...
</table>
The below shows how to supply the value directly through the options.
jQuery(function($){
$('.table').footable({
"state": {
"key": "YOUR_KEY"
}
});
});