Don't fail when datatables state was not saved before

This should fix issue #241
This commit is contained in:
Jan Böhmer 2023-03-10 01:40:54 +01:00 committed by GitHub
parent 80389ff236
commit 4ecf99c17e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -68,8 +68,10 @@ export default class extends Controller {
stateLoadCallback(settings) {
const data = JSON.parse( localStorage.getItem(this.getStateSaveKey()) );
//Do not save the start value (current page), as we want to always start at the first page on a page reload
data.start = 0;
if (data) {
//Do not save the start value (current page), as we want to always start at the first page on a page reload
data.start = 0;
}
return data;
}