File: state%28%29.xml

package info (click to toggle)
datatables.js 1.10.13%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 6,232 kB
  • ctags: 1,329
  • sloc: xml: 10,249; php: 4,387; sh: 492; makefile: 21
file content (60 lines) | stat: -rw-r--r-- 2,654 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0" encoding="UTF-8" ?>
<dt-api group="core">
	<name>state()</name>
	<summary>Get the last saved state of the table</summary>
	<since>1.10.1</since>

	<type type="function">
		<signature>state()</signature>
		<description>Get the last saved state of the table</description>
		<returns type="object">State saved object</returns>
	</type>

	<description>
		When state saving is enabled (`dt-init stateSave`) it can be useful to know what state has been saved for a table an any one specific moment. This method provides the ability to get the last data object that has been stored in by the state saving mechanism.

		The data object has the following format, but please be aware that plug-ins and extensions to DataTables can modify this structure by adding data as they require for their own state information.
		
		```js
		{
			"time":   {number}               // Time stamp of when the object was created
			"start":  {number}               // Display start point
			"length": {number}               // Page length
			"order":  {array}                // 2D array of column ordering information (see `order` option)
			"search": {
				"search":          {string}  // Search term
				"regex":           {boolean} // Indicate if the search term should be treated as regex or not
				"smart":           {boolean} // Flag to enable DataTables smart search
				"caseInsensitive": {boolean} // Case insensitive flag
			},
			"columns" [
				{
					"visible": {boolean}     // Column visibility
					"search":  {}            // Object containing column search information. Same structure as `search` above
				}
			]
		}
		```

		Please note that this method gives the last saved state, which is not necessarily the current state. For example the `dt-api page()` method will not automatically trigger a state save. Calling `dt-api draw()` will trigger a state save, or use `dt-api state.save()`.
	</description>

	<example title="Get the saved page length from the state object"><![CDATA[

alert( 'Saved page length is: '+ table.state().length );

]]></example>

	<related type="api">state.clear()</related>
	<related type="api">state.loaded()</related>
	<related type="api">state.save()</related>
	<related type="option">stateSave</related>
	<related type="option">stateSaveCallback</related>
	<related type="option">stateLoadCallback</related>
	<related type="option">stateLoadParams</related>
	<related type="option">stateSaveParams</related>
	<related type="option">stateLoaded</related>
	<related type="event">stateLoaded</related>
	<related type="event">stateLoadParams</related>
	<related type="event">stateSaveParams</related>
</dt-api>