I want to retrieve data that populated the table (raw data),
i cannot achieve it from 'getData' methods because its only returns current loaded data. i want another properties like 'last_page' etc
thank you in advance
Are you currently using remote Ajax Pagination or just loading all your table data in one go using setData and a url?
i am using 'remote' mode.. and in your documentations said that the server must return
{
"last_page":15, //the total number of available pages
"data":[ // an array of row data objects
{id:1, name:"bob", age:"23"}, //example row data object
]
}
then i just want to get the last_page value..
for me its free to achieve from outside script like 'getRawData' or via callbacks in dataLoaded:function(rawData){} ..
There isnt officially a way to access any of the additional data sent with the pagination response, it is used to configure Tabulators internal systems.
However you could extend tabulator to access this property. Add the following code after you include your tabulator.js file but before you define your tabulator table. You can then use the getMaxPage function to access the value at any time.
$.widget("ui.tabulator", $.ui.tabulator, {
getMaxPage:function(){
return this.paginationMaxPage;
}
});
To access the max page value at any point use the following code:
var maxPage = $("#example-table").tabulator("getMaxPage");
OK will do ..thank you for your reply
but i think a feature like this should be the tabulator default behaviour
How to know another available variables?
i see there no documentation for variable/property 'paginationMaxPage'
thank you
There is no documentation for internal system variables because they are used internally to maintain system state and in most cases it would be unsafe to access them directly, and they are not externally accessible under usual circumstances.
In this case you had to specifically extend tabulator to gain access to the variable.
To find out more about the internal system variables you would need to look at the code in the tabulator.js file, the internal variables are located between lines 38 and 78, but I would strongly advise against accessing any of them directly as it will likely cause tabulator to malfunction. all system properties that are safe to access are available through existing documented functionality.
I take your point about having access to the pagination details, i will certainly look at adding that to the next release, and will include max page. i will also add a new callback for when an ajax request is made that passes back the data from the request.
Good News!!!
Both of these features are now in, the maximum page can now be accessed by the getPageMax function
var maxPage = $("#example-table").tabulator("getPageMax");
There is now an ajaxResponse callback that is triggered on any successful ajax request and is passed the JSON response object:
$("#example-table").tabulator({
ajaxResponse:function(url, params, response){
//url - the URL of the request
//params - the parameters passed with the request
//response - the JSON object returend in the body of the response.
},
});
Perfect! thank you for your kindness :laughing:
Most helpful comment
Good News!!!
Both of these features are now in, the maximum page can now be accessed by the getPageMax function
There is now an ajaxResponse callback that is triggered on any successful ajax request and is passed the JSON response object: