Closed xcodeac closed 5 years ago
agree
is this problem solved? I get the same problem, thank you
@kimchuy @xcodeac @superRaytin
@hiiamninna Paginationjs doesn't have a way to handle "locator" exceptions, but I think the right way to handle it is to set a correct "locator" value when a "locator" exception occurs, and usually the exception can be immediately discovered at initialization.
@hiiamninna I just released 2.6.0
to support catching errors when rendering pagination, below is an example:
$('#demo').pagination({
dataSource: 'https://yoursite.com/path/to',
locator: 'items',
callback: function(data, pagination) {
// ...
},
onError: function(e, errorType) {
// do something
// in this case, errorType will be `ajaxSuccessHandlerError`
},
})
Oh, thank you @superRaytin
I have solved it btw, from the backend I initialize the nil locator with empty array and it worked thank you again for your explanation
Hi, can you please suggest how to handle exceptions where there is no results / no 'locator' element in the ajax response? Getting the below error:
Uncaught Error: Pagination: dataSource.items is undefined. , as the locator element was 'item' for my case.
Thanks in advance.