mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Docs: update pager widget options in demo code
This commit is contained in:
parent
a773ac63ed
commit
e1035db5df
@ -38,6 +38,26 @@
|
|||||||
widgets: ['zebra', 'filter', 'pager'],
|
widgets: ['zebra', 'filter', 'pager'],
|
||||||
widgetOptions: {
|
widgetOptions: {
|
||||||
|
|
||||||
|
// css class names of pager arrows
|
||||||
|
pager_css: {
|
||||||
|
container : 'tablesorter-pager',
|
||||||
|
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning)
|
||||||
|
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page)
|
||||||
|
},
|
||||||
|
|
||||||
|
// jQuery selectors
|
||||||
|
pager_selectors: {
|
||||||
|
container : '.pager', // target the pager markup (wrapper)
|
||||||
|
first : '.first', // go to first page arrow
|
||||||
|
prev : '.prev', // previous page arrow
|
||||||
|
next : '.next', // next page arrow
|
||||||
|
last : '.last', // go to last page arrow
|
||||||
|
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||||
|
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||||
|
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
// output default: '{page}/{totalPages}'
|
// output default: '{page}/{totalPages}'
|
||||||
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||||
// also {page:input} & {startRow:input} will add a modifiable input in place of the value
|
// also {page:input} & {startRow:input} will add a modifiable input in place of the value
|
||||||
@ -49,12 +69,24 @@
|
|||||||
// starting page of the pager (zero based index)
|
// starting page of the pager (zero based index)
|
||||||
pager_startPage: 0,
|
pager_startPage: 0,
|
||||||
|
|
||||||
|
// Reset pager to this page after filtering; set to desired page number
|
||||||
|
// (zero-based index), or false to not change page at filter start
|
||||||
|
pager_pageReset: 0,
|
||||||
|
|
||||||
// Number of visible rows
|
// Number of visible rows
|
||||||
pager_size: 25,
|
pager_size: 25,
|
||||||
|
|
||||||
|
// f true, child rows will be counted towards the pager set size
|
||||||
|
pager_countChildRows: false,
|
||||||
|
|
||||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||||
pager_savePages: true,
|
pager_savePages: true,
|
||||||
|
|
||||||
|
// Saves tablesorter paging to custom key if defined. Key parameter name
|
||||||
|
// used by the $.tablesorter.storage function. Useful if you have
|
||||||
|
// multiple tables defined
|
||||||
|
pager_storageKey: "tablesorter-pager",
|
||||||
|
|
||||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||||
// table row set to a height to compensate; default is false
|
// table row set to a height to compensate; default is false
|
||||||
pager_fixedHeight: false,
|
pager_fixedHeight: false,
|
||||||
@ -94,6 +126,18 @@
|
|||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Set this option to false if your table data is preloaded into the
|
||||||
|
// table, but you are still using ajax
|
||||||
|
pager_processAjaxOnInit: true,
|
||||||
|
|
||||||
|
// When processAjaxOnInit is set to false, set this option to contain
|
||||||
|
// the total number of rows and filtered rows to prevent an initial ajax
|
||||||
|
// call
|
||||||
|
initialRows: {
|
||||||
|
total: 100,
|
||||||
|
filtered: 100
|
||||||
|
},
|
||||||
|
|
||||||
// process ajax so that the following information is returned:
|
// process ajax so that the following information is returned:
|
||||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
||||||
// example:
|
// example:
|
||||||
@ -140,26 +184,6 @@
|
|||||||
// in version 2.10, you can optionally return $(rows) a set of table rows within a jQuery object
|
// in version 2.10, you can optionally return $(rows) a set of table rows within a jQuery object
|
||||||
return [ total, rows, headers ];
|
return [ total, rows, headers ];
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
// css class names of pager arrows
|
|
||||||
pager_css: {
|
|
||||||
container : 'tablesorter-pager',
|
|
||||||
errorRow : 'tablesorter-errorRow', // error information row (don't include period at beginning)
|
|
||||||
disabled : 'disabled' // class added to arrows @ extremes (i.e. prev/first arrows "disabled" on first page)
|
|
||||||
},
|
|
||||||
|
|
||||||
// jQuery selectors
|
|
||||||
pager_selectors: {
|
|
||||||
container : '.pager', // target the pager markup (wrapper)
|
|
||||||
first : '.first', // go to first page arrow
|
|
||||||
prev : '.prev', // previous page arrow
|
|
||||||
next : '.next', // next page arrow
|
|
||||||
last : '.last', // go to last page arrow
|
|
||||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
|
||||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
|
||||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,66 +37,9 @@
|
|||||||
|
|
||||||
widgetOptions: {
|
widgetOptions: {
|
||||||
|
|
||||||
// output default: '{page}/{totalPages}'
|
// ** NOTE: All default ajax options have been removed from this demo,
|
||||||
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
// see the example-widget-pager-ajax demo for a full list of pager
|
||||||
// also {page:input} & {startRow:input} will add a modifiable input in place of the value
|
// options
|
||||||
pager_output: '{startRow:input} – {endRow} / {totalRows} rows', // '{page}/{totalPages}'
|
|
||||||
|
|
||||||
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
|
||||||
pager_updateArrows: true,
|
|
||||||
|
|
||||||
// starting page of the pager (zero based index)
|
|
||||||
pager_startPage: 0,
|
|
||||||
|
|
||||||
// Number of visible rows
|
|
||||||
pager_size: 10,
|
|
||||||
|
|
||||||
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
|
||||||
pager_savePages: true,
|
|
||||||
|
|
||||||
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
|
||||||
// table row set to a height to compensate; default is false
|
|
||||||
pager_fixedHeight: true,
|
|
||||||
|
|
||||||
// remove rows from the table to speed up the sort of large tables.
|
|
||||||
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
|
||||||
pager_removeRows: false, // removing rows in larger tables speeds up the sort
|
|
||||||
|
|
||||||
// use this format: "http://mydatabase.com?page={page}&size={size}&{sortList:col}&{filterList:fcol}"
|
|
||||||
// where {page} is replaced by the page number, {size} is replaced by the number of records to show,
|
|
||||||
// {sortList:col} adds the sortList to the url into a "col" array, and {filterList:fcol} adds
|
|
||||||
// the filterList to the url into an "fcol" array.
|
|
||||||
// So a sortList = [[2,0],[3,0]] becomes "&col[2]=0&col[3]=0" in the url
|
|
||||||
// and a filterList = [[2,Blue],[3,13]] becomes "&fcol[2]=Blue&fcol[3]=13" in the url
|
|
||||||
pager_ajaxUrl: null,
|
|
||||||
|
|
||||||
// modify the url after all processing has been applied
|
|
||||||
pager_customAjaxUrl: function(table, url) { return url; },
|
|
||||||
|
|
||||||
// ajax error callback from $.tablesorter.showError function
|
|
||||||
// pager_ajaxError: function( config, xhr, settings, exception ){ return exception; };
|
|
||||||
// returning false will abort the error message
|
|
||||||
pager_ajaxError: null,
|
|
||||||
|
|
||||||
// modify the $.ajax object to allow complete control over your ajax requests
|
|
||||||
pager_ajaxObject: {
|
|
||||||
dataType: 'json'
|
|
||||||
},
|
|
||||||
|
|
||||||
// process ajax so that the following information is returned:
|
|
||||||
// [ total_rows (number), rows (array of arrays), headers (array; optional) ]
|
|
||||||
// example:
|
|
||||||
// [
|
|
||||||
// 100, // total rows
|
|
||||||
// [
|
|
||||||
// [ "row1cell1", "row1cell2", ... "row1cellN" ],
|
|
||||||
// [ "row2cell1", "row2cell2", ... "row2cellN" ],
|
|
||||||
// ...
|
|
||||||
// [ "rowNcell1", "rowNcell2", ... "rowNcellN" ]
|
|
||||||
// ],
|
|
||||||
// [ "header1", "header2", ... "headerN" ] // optional
|
|
||||||
// ]
|
|
||||||
pager_ajaxProcessing: function(ajax){ return [ 0, [], null ]; },
|
|
||||||
|
|
||||||
// css class names that are added
|
// css class names that are added
|
||||||
pager_css: {
|
pager_css: {
|
||||||
@ -115,7 +58,44 @@
|
|||||||
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
gotoPage : '.gotoPage', // go to page selector - select dropdown that sets the current page
|
||||||
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
pageDisplay : '.pagedisplay', // location of where the "output" is displayed
|
||||||
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
pageSize : '.pagesize' // page size selector - select dropdown that sets the "size" option
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// output default: '{page}/{totalPages}'
|
||||||
|
// possible variables: {size}, {page}, {totalPages}, {filteredPages}, {startRow}, {endRow}, {filteredRows} and {totalRows}
|
||||||
|
// also {page:input} & {startRow:input} will add a modifiable input in place of the value
|
||||||
|
pager_output: '{startRow:input} – {endRow} / {totalRows} rows', // '{page}/{totalPages}'
|
||||||
|
|
||||||
|
// apply disabled classname to the pager arrows when the rows at either extreme is visible
|
||||||
|
pager_updateArrows: true,
|
||||||
|
|
||||||
|
// starting page of the pager (zero based index)
|
||||||
|
pager_startPage: 0,
|
||||||
|
|
||||||
|
// Reset pager to this page after filtering; set to desired page number
|
||||||
|
// (zero-based index), or false to not change page at filter start
|
||||||
|
pager_pageReset: 0,
|
||||||
|
|
||||||
|
// Number of visible rows
|
||||||
|
pager_size: 10,
|
||||||
|
|
||||||
|
// f true, child rows will be counted towards the pager set size
|
||||||
|
pager_countChildRows: false,
|
||||||
|
|
||||||
|
// Save pager page & size if the storage script is loaded (requires $.tablesorter.storage in jquery.tablesorter.widgets.js)
|
||||||
|
pager_savePages: true,
|
||||||
|
|
||||||
|
// Saves tablesorter paging to custom key if defined. Key parameter name
|
||||||
|
// used by the $.tablesorter.storage function. Useful if you have
|
||||||
|
// multiple tables defined
|
||||||
|
pager_storageKey: "tablesorter-pager",
|
||||||
|
|
||||||
|
// if true, the table will remain the same height no matter how many records are displayed. The space is made up by an empty
|
||||||
|
// table row set to a height to compensate; default is false
|
||||||
|
pager_fixedHeight: true,
|
||||||
|
|
||||||
|
// remove rows from the table to speed up the sort of large tables.
|
||||||
|
// setting this to false, only hides the non-visible rows; needed if you plan to add/remove rows with the pager enabled.
|
||||||
|
pager_removeRows: false // removing rows in larger tables speeds up the sort
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user