stateRestore.bookmark.src
Bookmark source value location.
Please note - this property requires the StateRestore extension for DataTables.
Description
In order for StateRestore to be able to load a bookmarked state, it must be able to identify which part of the URL holds the value that will identify the state. This parameter provides that ability.
StateRestore can find the state identifier in either:
- The URL query / search parameters
- The URL's hash
Which to use will depend upon your application and if you are already making use of either. A hash has the benefit of not requiring a full page reload if you are linking to a state from the current page, but there is no separation of parameters in the hash. The search parameter however provide an easy to use separation method, but they can also be used to identify different content to display on the page, and thus state sharing between them might not be appropriate.
Select the correct option for your application.
Type
string
This value can be one of the following:
- Empty string (default) - bookmarking in StateRestore disabled
?{name}- Use a query / search parameter where the parameter name is defined by{name}#- Use the URL hash as the state identifier#{name}- Use the value after#{name}, from the URL hash, as the state identifier.
Examples
Using a dtsr query parameter for the state identifier:
new DataTable('#myTable', {
layout: {
topStart: {
buttons: ['stateCreate', 'statesList', 'pageLength']
}
},
stateRestore: {
bookmark: {
src: '?dtsr'
}
}
});Using a hash for the state identifier:
new DataTable('#myTable', {
layout: {
topStart: {
buttons: ['stateCreate', 'statesList', 'pageLength']
}
},
stateRestore: {
bookmark: {
src: '#'
}
}
});Related
The following options are directly related and may also be useful in your application development.