stateRestore.bookmark.match
Bookmark match target.
Please note - this property requires the StateRestore extension for DataTables.
Description
When a value is found by stateRestore.bookmark.src, it can be configured to match against either a state id, or a state name - this configuration option controls which.
Using an id is generally preferred as it cannot change once created, unlike a state name, which can (if operating on an end user defined state, not a predefined one). If the state name changes, then any existing bookmarks pointing to it will no longer load, unlike when an id is used.
However, using a name can sometimes be desirable as it provides more context in the URL, allowing the end user to more easily identify a state. It is recommended that you only use name based bookmarking in StateRestore with stateRestore.predefined states, and disallow the end user from creating their own states.
Type
string
This value can be one of the following:
id(default) - bookmarked state is found based on its ID and the source value foundname- bookmarked state is found based on the name of the states.
Example
Find a state based on the state's name and the value of the dtsr query parameter:
new DataTable('#myTable', {
layout: {
topStart: {
buttons: ['stateCreate', 'statesList', 'pageLength']
}
},
stateRestore: {
bookmark: {
match: 'name',
src: '?dtsr'
}
}
});Related
The following options are directly related and may also be useful in your application development.