<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>StateRestore — DataTables forums</title>
        <link>https://next.datatables.net/forums/</link>
        <pubDate>Wed, 22 Jul 2026 01:34:37 +0000</pubDate>
        <language>en</language>
            <description>StateRestore — DataTables forums</description>
    <language>en</language>
    <atom:link href="https://next.datatables.net/forums/categories/staterestore/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>StateRestore ColumnControl saving by column index not column name</title>
        <link>https://next.datatables.net/forums/discussion/81806/staterestore-columncontrol-saving-by-column-index-not-column-name</link>
        <pubDate>Wed, 17 Jun 2026 15:10:29 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>bg7</dc:creator>
        <guid isPermaLink="false">81806@/forums/discussions</guid>
        <description><![CDATA[<p>We're running into an issue with StateRestore.  It's been working well up until we added a new column to the table that users are using to save states (the new column was added into the middle of the table in terms of column order).  As a result, the saved state data appears to no longer line up with the columns they were saved for.  I looked at the StateRestore data and I see this:</p>

<pre><code>"columnControl": {
  "2": {
    "searchList": [],
    "searchInput": {
      "logic": "contains",
      "type": "text",
      "value": ""
    }
  },
  "3": {
    "searchList": [],
    "searchInput": {
      "logic": "contains",
      "type": "text",
      "value": ""
    }
  },
  "4": {
    "searchList": [],
    "searchInput": {
      "logic": "contains",
      "type": "text",
      "value": ""
    }
  },
  "6": {
    "searchInput": {
      "logic": "contains",
      "type": "text",
      "value": ""
    }
  },
  "7": {
    "searchList": [],
    "searchInput": {
      "logic": "contains",
      "type": "text",
      "value": ""
    }
  }
},
</code></pre>

<p>If we add a new column it has no way to know how to map the saved data to the correct (updated) columns as it's mapping by column index instead of column name.  This ends up breaking all of the existing saved states.  Am I missing something or don't have StateRestore/ColumnControl configured properly so that it stores this data by column name instead?</p>

<p>Fwiw we're running DataTables 2.3.8, StateRestore 1.4.3 and ColumnControl 1.2.1.</p>

<p>Thanks.</p>

<p>Ben</p>
]]>
        </description>
    </item>
    <item>
        <title>State Restore is not clearing out previous ColumnControl filters on loading saved states</title>
        <link>https://next.datatables.net/forums/discussion/81734/state-restore-is-not-clearing-out-previous-columncontrol-filters-on-loading-saved-states</link>
        <pubDate>Wed, 08 Apr 2026 21:26:25 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>bg7</dc:creator>
        <guid isPermaLink="false">81734@/forums/discussions</guid>
        <description><![CDATA[<p>I'm using State Restore to save search states including columns using ColumnControl filters.  If I load a saved state that has items selected in the column's filter list and then I load a second state with different items selected in that same filter list I end up with a union of the two lists.  That said, it's only the column filter list drop-down that's incorrect.  The actual table is correct and only shows the values for the items saved in the second state.</p>

<p>For example, this is saved state 1:<br />
<img src="https://datatables.net/forums/uploads/editor/dg/brex9nztt3gr.png" alt="" title="" /></p>

<p>If I then clear out the search and load saved state 2:<br />
<img src="https://datatables.net/forums/uploads/editor/gc/be00f9uf9ltw.png" alt="" title="" /></p>

<p>However, if I load state 1 and then don't clear the search and load state two I get a union of the two:<br />
<img src="https://datatables.net/forums/uploads/editor/xq/rcgujekrjqef.png" alt="" title="" /></p>

<p>But as I mentioned, the actual rows displayed are correct and match state 2.  It's only the column filter check marks that are out of sync.</p>

<p>I asked Coplilot to track this down and it did.  I don't know how good the code is but it did fix the issue.  Here are the changes it suggested:<br />
<img src="https://datatables.net/forums/uploads/editor/8z/bn2hao603zfw.png" alt="" title="" /><br />
<img src="https://datatables.net/forums/uploads/editor/at/w3kq99blr1kf.png" alt="" title="" /></p>

<p>Here's the updated code:</p>

<pre><code>CheckList.prototype.values = function (values) {
    var buttons = this._s.buttons;
    if (values === undefined) {
        var out = [];
        for (var j = 0; j &lt; buttons.length; j++) {
            if (buttons[j].active()) {
                out.push(buttons[j].value());
            }
        }
        return out;
    }

    // Fix: replace selection set (do not merge with previous active values)
    this.selectNone();
    values = values || [];
    for (var i = 0; i &lt; values.length; i++) {
        var btn = this.button(values[i]);
        if (btn) {
            btn.active(true);
        }
    }
    var count = this.values().length;
    this._dom.selectNoneCount.innerHTML = count ? '(' + count + ')' : '';

    return this;
};
</code></pre>

<p>And the second block:</p>

<pre><code>    dt.on('stateLoaded', function (e, s, state) {
        var values = getState(_this.idxOriginal(), state) || [];
        checkList.values(values); // always apply, including empty =&gt; clear
        applySearch(values);
    });
</code></pre>

<p>Do these changes make sense?  Is this ok or is there a better way to fix this?</p>

<p>Thanks.</p>

<p>Ben</p>
]]>
        </description>
    </item>
    <item>
        <title>State Restore - looping through states and filter data</title>
        <link>https://next.datatables.net/forums/discussion/81707/state-restore-looping-through-states-and-filter-data</link>
        <pubDate>Mon, 09 Mar 2026 17:44:11 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>bg7</dc:creator>
        <guid isPermaLink="false">81707@/forums/discussions</guid>
        <description><![CDATA[<p>I'm using State Restore and want to loop through the saved states and collect data from the rows that appear when each state is loaded.  The approach I'm currently using works but is complicated.  It is roughly as follows:</p>

<ol>
<li>Save the current state to a temporary state.</li>
<li>Loop through the existing saved states, load one at a time and listen for the draw to complete as each state is applied, then grab the resulting rows and get the data I need and save that data off to a list.</li>
<li>Restore the saved temporary state.</li>
<li>Remove the temporary state.</li>
<li>Switch to another screen to use the collected data (in this case to generate charts based on the user's saved states all at once).</li>
</ol>

<p>It all happens quickly enough that you can't tell as a user which is good.  That said, it is complicated and I was hoping I could simply loop through the saved states and ask for the filtered data for each state without affecting the current table.  Is it possible and I've missed a simple way to do this?  If I could call something like filter() on the state that would massively simplify things but from what I can tell that's not currently possible.</p>

<p><a rel="nofollow" href="https://datatables.net/reference/api/filter()">https://datatables.net/reference/api/filter()</a></p>

<p>One other thing I wanted to ask is if there's a way to add a confirmation modal to the "Remove All" for states.  By default there's a confirmation modal when you try to remove a single state which seems reasonable but there's no confirmation modal if you remove all of the states at once which seems odd given it's potentially far more destructive.  A confirmation modal by default would be great.  I couldn't figure out a simple way to add one in manually.</p>

<p><a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/removeAll.html">https://datatables.net/extensions/staterestore/examples/initialisation/removeAll.html</a></p>

<p>Thanks.</p>

<p>Ben</p>
]]>
        </description>
    </item>
    <item>
        <title>stateSave is saving states despite being overridden in stateSaveParams</title>
        <link>https://next.datatables.net/forums/discussion/81224/statesave-is-saving-states-despite-being-overridden-in-statesaveparams</link>
        <pubDate>Fri, 01 Aug 2025 16:33:56 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>bg7</dc:creator>
        <guid isPermaLink="false">81224@/forums/discussions</guid>
        <description><![CDATA[<p>In the documentation for stateSaveParams there is an example for overriding the default behavior to only save specific fields.</p>

<p><a rel="nofollow" href="https://datatables.net/reference/option/stateSaveParams">https://datatables.net/reference/option/stateSaveParams</a></p>

<p>In this example I'm deleting everything (I think):</p>

<p><a rel="nofollow" href="https://live.datatables.net/bagodele/1/edit">https://live.datatables.net/bagodele/1/edit</a></p>

<p>And yet some of the data is still getting saved to local storage.</p>

<p><img src="https://datatables.net/forums/uploads/editor/yy/1ccc5u5v91br.png" alt="" title="" /></p>

<p>I need to make sure the selected row(s) in particular isn't saved.  Am I doing something wrong?</p>

<p>Thanks.</p>

<p>Ben</p>
]]>
        </description>
    </item>
    <item>
        <title>Ajax-sourced data not showing active states on reload (see your example)</title>
        <link>https://next.datatables.net/forums/discussion/81081/ajax-sourced-data-not-showing-active-states-on-reload-see-your-example</link>
        <pubDate>Mon, 23 Jun 2025 19:57:00 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>cuspenser</dc:creator>
        <guid isPermaLink="false">81081@/forums/discussions</guid>
        <description><![CDATA[<p>Hi Team,</p>

<p>I've noticed an issue in your <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/ajax.html" title="example">example</a> page that reflects a similar issue I am having within my own application.</p>

<p>On that page, here are the steps to follow:</p>

<ol>
<li>Create two or three states.</li>
<li>Select one of the states and you should see that it's highlighted as the active state (checkmark next to the active state)</li>
<li>Reload the page (your saved states should still be present)</li>
<li>Click on one of the states. You should see that it's <strong>not</strong> highlighted as an active state. (no checkmarks)</li>
<li>Create a new state. You should see that new state is highlighted (has checkmark)</li>
<li>Click one of the other states you created previously, they won't highlight to indicate they're the active state. (no checkmark)</li>
<li>Go back to the state you just created (checkmark is present)</li>
</ol>

<p>Here is a <a rel="nofollow" href="https://drive.google.com/file/d/1gppI0FpVjNYYe8YZyybeC92Lml2NS6JE/view?usp=sharing" title="video">video</a> of the example page where this is occurring.</p>

<p>Thoughts on how to have DataTables recognize the active state on ajax-sourced data after a page reload?</p>

<p>Thanks,</p>

<p>Tanner</p>
]]>
        </description>
    </item>
    <item>
        <title>What would cause the dropdown for savedStates to be empty</title>
        <link>https://next.datatables.net/forums/discussion/79265/what-would-cause-the-dropdown-for-savedstates-to-be-empty</link>
        <pubDate>Sun, 23 Jun 2024 19:21:43 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>ksmith</dc:creator>
        <guid isPermaLink="false">79265@/forums/discussions</guid>
        <description><![CDATA[<p>There is no error message.<br />
I can see the saved states in the Local Storage.<br />
Basic setup is:<br />
'createState',<br />
            {<br />
                extend: 'savedStates',<br />
                config: {<br />
                    creationModal: true,<br />
                },<br />
            },</p>
]]>
        </description>
    </item>
    <item>
        <title>Restoring column order regarding rowgrouping.</title>
        <link>https://next.datatables.net/forums/discussion/73853/restoring-column-order-regarding-rowgrouping</link>
        <pubDate>Mon, 29 Aug 2022 16:43:13 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>khaos</dc:creator>
        <guid isPermaLink="false">73853@/forums/discussions</guid>
        <description><![CDATA[<p>My test link will not load the ajax txt for whatever reason.  <a rel="nofollow" href="https://jsfiddle.net/Cyberjetx/6as7o4gb/1/">https://jsfiddle.net/Cyberjetx/6as7o4gb/1/</a></p>

<p>The issue is after a reloading how can I set the group column.  Currently we are using ordinals as in the main row group example.  Is there a way to use a class or other more data driven method.</p>

<p>I tried the following:</p>

<pre><code>function GetGroupOrdinal() {
    let retVal = 0;
    let elem = $('#CASREPTbl th');
    //console.log('Length : ' + elem.length);
    elem.each(function () {
        if ($(this).hasClass('grpBy')) {
            retVal = elem.index(this);
            console.log("GetGroupOrdinal: ", retVal);
        }
    });
    return retVal;
}
</code></pre>

<p>with the following:</p>

<pre><code>...
                rowGroup: {
                dataSrc: (GetGroupOrdinal()),
                startRender: function (rows, group) {
                    var collapsed = !!collapsedGroups[group];

                    rows.nodes().each(function (r) {
                        r.style.display = collapsed ? 'none' : '';
                    });

                    // Add category name to the &lt;tr&gt;. NOTE: Hardcoded colspan
                    return $('&lt;tr/&gt;')
                        .append('&lt;td colspan="99" class="RowGroupText"&gt;CASREP ' + group + ' (' + rows.count() + ')&lt;/td&gt;')
                        .attr('data-name', group)
                        .toggleClass('collapsed', collapsed);
                }
            },
...
</code></pre>

<p>this works until the column reorder changes the group ordinal.  I really am sorry I cant get the test link up and going. I hope you can see my issue.</p>
]]>
        </description>
    </item>
    <item>
        <title>Error initialisation with other extension</title>
        <link>https://next.datatables.net/forums/discussion/73801/error-initialisation-with-other-extension</link>
        <pubDate>Wed, 24 Aug 2022 13:26:45 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>guen</dc:creator>
        <guid isPermaLink="false">73801@/forums/discussions</guid>
        <description><![CDATA[<p>I try to test this extension but I have 2 errors<br />
Initialisation is<br />
<a rel="nofollow" href="https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.12.1/b-1.6.5/b-colvis-1.6.5/b-html5-1.6.5/b-print-1.6.5/fc-3.3.2/fh-3.1.7/kt-2.5.3/r-2.2.6/rg-1.1.2/rr-1.2.7/sc-2.0.3/sp-1.2.2/sl-1.3.1/datatables.min">https://cdn.datatables.net/v/bs4/jszip-2.5.0/dt-1.12.1/b-1.6.5/b-colvis-1.6.5/b-html5-1.6.5/b-print-1.6.5/fc-3.3.2/fh-3.1.7/kt-2.5.3/r-2.2.6/rg-1.1.2/rr-1.2.7/sc-2.0.3/sp-1.2.2/sl-1.3.1/datatables.min</a><br />
+ extension colreorder + searchpane + select and moment-with-locales.min.js + datetime-moment.js</p>

<p>2 problems :<br />
1. when I use jQuery.fn.dataTable.moment( 'DD/MM/YYYY' ); in my code, I have an error<br />
1. when I put the button savedStates, I have an error a.button(...).collectionRebuild is not a function<br />
2. when I clic on createState, I have an error Cannot read properties of undefined (reading 'c') at B.action (dataTables.stateRestore.min.js:99:137)</p>

<p>maybe a conflict between extensions I guess....<br />
can you help me please ?<br />
thank's</p>
]]>
        </description>
    </item>
    <item>
        <title>Bootstrap 3 issue with state dropdown-arrow menu</title>
        <link>https://next.datatables.net/forums/discussion/73777/bootstrap-3-issue-with-state-dropdown-arrow-menu</link>
        <pubDate>Mon, 22 Aug 2022 14:34:21 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>Benjamin.Smith@OptimalAnswers.com</dc:creator>
        <guid isPermaLink="false">73777@/forums/discussions</guid>
        <description><![CDATA[<p><a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/styling/bootstrap3.html">Example Page</a></p>

<p>After creating a state in the example, clicking on the arrow (to update/delete state) returns an empty box. On inspection, the elements are present, but the styling for the height is broken.</p>
]]>
        </description>
    </item>
    <item>
        <title>Is it possible to display a working progress bar or spinner when a State is Selected ?</title>
        <link>https://next.datatables.net/forums/discussion/73036/is-it-possible-to-display-a-working-progress-bar-or-spinner-when-a-state-is-selected</link>
        <pubDate>Thu, 09 Jun 2022 19:44:55 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">73036@/forums/discussions</guid>
        <description><![CDATA[<p>I have a table which has 8000 rows.   I am using search builder and state restore.</p>

<p>When select a state which limits the data to 3600 of the 8000 it takes about 6 seconds for the menu to drop after I make the selection.</p>

<p>Is it possible to display some working indicator once a state is selected and drop it when the menu drops ?</p>
]]>
        </description>
    </item>
    <item>
        <title>Processing indicator with stateRestore</title>
        <link>https://next.datatables.net/forums/discussion/71729/processing-indicator-with-staterestore</link>
        <pubDate>Fri, 18 Feb 2022 13:23:25 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71729@/forums/discussions</guid>
        <description><![CDATA[<p>It it possible to show the <a rel="nofollow" href="https://datatables.net/reference/option/processing" title="processing indicator">processing indicator</a> when a state is loaded from stateRestore?</p>

<p>I added <code>processing : true</code> and <code>table.processing(true);</code> with <code>setTimeout</code> into <code>stateLoadParams</code>, but this does not seem to work. Is there a different place where I need to add the processing code?</p>

<p>Test case: <a rel="nofollow" href="http://live.datatables.net/pivofaco/1/edit" title="live.datatables.net/pivofaco/1/edit">live.datatables.net/pivofaco/1/edit</a></p>
]]>
        </description>
    </item>
    <item>
        <title>How can I exclude the # rows displayed from State Restore?</title>
        <link>https://next.datatables.net/forums/discussion/71914/how-can-i-exclude-the-rows-displayed-from-state-restore</link>
        <pubDate>Thu, 03 Mar 2022 23:55:28 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71914@/forums/discussions</guid>
        <description><![CDATA[<p>We want to allow States to load without changing the # rows displayed.</p>

<p>I thought "paging" would be the setting to turn off but that doesn't work.</p>

<p>Is it possible to disable # rows displayed from a saved state ?</p>

<p>I don't see one on the documentation page <a rel="nofollow" href="https://datatables.net/reference/option/stateRestore.saveState">https://datatables.net/reference/option/stateRestore.saveState</a></p>
]]>
        </description>
    </item>
    <item>
        <title>Saving/renaming states for stateRestore in database</title>
        <link>https://next.datatables.net/forums/discussion/71758/saving-renaming-states-for-staterestore-in-database</link>
        <pubDate>Sun, 20 Feb 2022 12:20:43 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71758@/forums/discussions</guid>
        <description><![CDATA[<p>I am exploring how to load, save, and rename states for stateRestore from a SQL database with Ajax. I understand that it is possible to save and load states from stateRestore <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/ajax.html" title="using Ajax as per this example">using Ajax as per this example</a>. To load the table data and stateRestore states, the Ajax data must come <a rel="nofollow" href="https://github.com/DataTables/StateRestore/blob/master/examples/data/2500States.txt" title="in this format">in this format</a>.</p>

<p>I'm struggling to find examples how to write the relevant Ajax data to save/rename a state in a database for stateRestore as this is a relatively new feature. Ideally I am looking to save/rename states by modifying/adding elements to <a rel="nofollow" href="https://github.com/DataTables/StateRestore/blob/master/examples/data/2500States.txt" title="the same format">the same format</a> and to write them into the database. I also cannot find any similar Ajax writing code for datatables as I believe this is only used in stateRestore.</p>

<p>Are there maybe any examples I could learn from or refer to for this? Appreciate your input!</p>
]]>
        </description>
    </item>
    <item>
        <title>Saved States modal switching to Dropdown when managing a State</title>
        <link>https://next.datatables.net/forums/discussion/72217/saved-states-modal-switching-to-dropdown-when-managing-a-state</link>
        <pubDate>Thu, 31 Mar 2022 09:25:17 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>growe19</dc:creator>
        <guid isPermaLink="false">72217@/forums/discussions</guid>
        <description><![CDATA[<p>I am not a developer and very much a copy and paste coder. Using tutorials to my best advantage, tweaking them to do what I require. I've looked at all the Datatables examples and got this far, however...</p>

<p>I have a button for Saved States. When clicked it loads the Modal to Create State or Manage the previously saved ones.</p>

<p><strong>Link to test case</strong>: <a rel="nofollow" href="https://garyrowe.co.uk/acc/?mode=dev">https://garyrowe.co.uk/acc/?mode=dev</a><br />
There is also: ?mode=live and ?mode=ip<br />
If you would like to see data in the table you need SimHub (<a rel="nofollow" href="https://www.simhubdash.com/download-2/)">https://www.simhubdash.com/download-2/)</a> and the Swoop plugin (<a rel="nofollow" href="https://www.racedepartment.com/downloads/simhub-swoop-plugin.48487/)">https://www.racedepartment.com/downloads/simhub-swoop-plugin.48487/)</a><br />
<strong>Debugger code (debug.datatables.net)</strong>: <a rel="nofollow" href="https://debug.datatables.net/uwupek">https://debug.datatables.net/uwupek</a><br />
<strong>Error messages shown</strong>: None<br />
<strong>Description of problem</strong>:<br />
- On the Modal that appears the dropdown arrow button is wider than the button with the Saved State Title on it.<br />
- When you click on the dropdown arrow it loads a dropdown menu from the button in the menu bar instead of a new Modal.<br />
- In summary the UI is all off basically.</p>

<p><img src="https://datatables.net/forums/uploads/editor/1r/idsddz8hc8m9.png" alt="" title="" /><br />
<img src="https://datatables.net/forums/uploads/editor/o6/x49wtz1d2vz5.png" alt="" title="" /></p>
]]>
        </description>
    </item>
    <item>
        <title>DataTable individual searching column working with stateSave function</title>
        <link>https://next.datatables.net/forums/discussion/72130/datatable-individual-searching-column-working-with-statesave-function</link>
        <pubDate>Wed, 23 Mar 2022 16:36:05 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>barneybear</dc:creator>
        <guid isPermaLink="false">72130@/forums/discussions</guid>
        <description><![CDATA[<p>I got the individual searching column working fine with stateSave function, but when I jump to another page and redirect back to the table, the table got filtered based on the searching that I just did before but the searching field got cleared. But for this issue, I have followed the solution shared by Bfullen here...<a rel="nofollow" href="https://datatables.net/forums/discussion/comment/89795/#Comment_89795">https://datatables.net/forums/discussion/comment/89795/#Comment_89795</a> and it works just fine...</p>

<p>Now the problem is, the pagination state saving is not functioning anymore after implementing Bfullen's code..Can someone please help? how to make it both work together?(saving the search value when redirecting back to the page, and also saving the pagination state as well)</p>
]]>
        </description>
    </item>
    <item>
        <title>Active States is incorrect when using Ajax and SearchBuilder</title>
        <link>https://next.datatables.net/forums/discussion/71560/active-states-is-incorrect-when-using-ajax-and-searchbuilder</link>
        <pubDate>Mon, 07 Feb 2022 19:41:29 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71560@/forums/discussions</guid>
        <description><![CDATA[<p>I can't create a test case for this because it is only happening to me when I use StateRestore stored by ajax.</p>

<p>I think only started recently after updating to the latest versions of SearchBuilder-1.3.1, StateRestore-1.1.0 and Buttons 2.2.2.</p>

<p>The problem I am having is if I create 3 saved states as follows<br />
1) Default State - no search builder filter<br />
2) Filter 1 - Define a rule in search builder to filter the data<br />
3) Filter 2 - Define a different rule in search builder to filter the data a different way</p>

<p>Then if I select Default State, I get active states "Default State"<br />
If I select Filter 1, I get active states "Default State, Filter 1"<br />
If I select Filter 2, I get active states "Default State, Filter 2"</p>

<p>It only seems to consider the SeachBuilder data if there is some data present.   If no data is present then it is consider a match even when the current state of SearchBuilder does contain data.</p>

<p>Here are screen shots of this happening in my system.  These shots were taken without making any changes to the saved states.</p>

<p>When I select my "Default View" you can note that Only Default View is active.<br />
<img src="https://datatables.net/forums/uploads/editor/wp/1tthuljxjjw3.png" alt="" title="" /></p>

<p>When I select "Pending View", you can note that Pending View is active but so is Default View which is incorrect.<br />
<img src="https://datatables.net/forums/uploads/editor/1u/5eg344rn6tuo.png" alt="" title="" /></p>

<p>When I switch to "award filter", you can note that award filter is active but so is Default View again which is incorrect.<br />
<img src="https://datatables.net/forums/uploads/editor/xt/ag3fvip9zmpm.png" alt="" title="" /></p>

<p>If I change the sorting and have no search builder data like this "test" case then it works as expected.<br />
<img src="https://datatables.net/forums/uploads/editor/t4/6xa0q2jtdyap.png" alt="" title="" /></p>

<p>Then I added a SearchBuilder filter and test remains active (This is incorrect)<br />
<img src="https://datatables.net/forums/uploads/editor/ef/xr36h9kb2zcm.png" alt="" title="" /></p>

<p>If I save that state, then the same issue happens with both being active even though one has a search builder filter and the other does not.<br />
<img src="https://datatables.net/forums/uploads/editor/29/cbai9iewtkts.png" alt="" title="" /></p>

<p>If I then select the test view and add a search builder with no conditions (not sure why this is allowed), and I save that state<br />
<img src="https://datatables.net/forums/uploads/editor/jj/xnqrfqjnrumx.png" alt="" title="" /></p>

<p>Then that Saved State matches "test" which sort of makes sense since the results are the same but in reality what is in the saved state for SearchBuilder is in fact different.  One has search builder data but it's "empty" the other has no search builder data.<br />
<img src="https://datatables.net/forums/uploads/editor/dw/c6uene4n9n70.png" alt="" title="" /></p>

<p>If I look at what is stored in the DB I notice that in every case "searchBuilder":false is present which I think might be causing this issue.</p>

<p>Here is the saved data for "Default View"<br />
<code>{"time":1644261222297,"start":0,"length":10,"order":[[5,"desc"]],"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true},"columns":[{"visible":false,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}}],"ColReorder":[0,1,2,3,4,5,6,7,8,9,10],"childRows":[],"searchBuilder":{},"page":0,"stateRestore":{"isPredefined":false,"state":"Default View","tableId":"award-person-table","isPreDefined":false},"c":{"_createInSaved":true,"create":true,"creationModal":true,"i18n":{"creationModal":{"button":"Create","colReorder":"Column Order","columns":{"search":"Column Search","visible":"Column Visibility"},"name":"Name:","order":"Sorting","paging":"Paging","scroller":"Scroll Position","search":"Search","searchBuilder":"SearchBuilder","searchPanes":"SearchPanes","select":"Select","title":"Create New State","toggleLabel":"Includes:"},"duplicateError":"A state with this name already exists.","emptyError":"Name cannot be empty.","emptyStates":"No saved states","removeConfirm":"Are you sure you want to remove %s?","removeError":"Failed to remove state.","removeJoiner":" and ","removeSubmit":"Remove","removeTitle":"Remove State","renameButton":"Rename","renameLabel":"New Name for %s:","renameTitle":"Rename State"},"modalCloseButton":true,"remove":true,"rename":true,"save":true,"saveState":{"colReorder":true,"columns":{"search":true,"visible":true},"order":true,"paging":true,"scroller":true,"search":true,"searchBuilder":true,"searchPanes":true,"select":true},"splitSecondaries":["updateState","removeState","renameState"],"toggle":{"colReorder":false,"columns":{"search":false,"visible":false},"order":false,"paging":false,"scroller":false,"search":false,"searchBuilder":false,"searchPanes":false,"select":false},"preDefined":{}}}</code></p>

<p>Here is the data for "Pending View" which makes "Default View" active but should not.<br />
<code>{"time":1644261246795,"start":0,"length":10,"order":[[5,"desc"]],"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true},"columns":[{"visible":false,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}},{"visible":true,"search":{"search":"","smart":true,"regex":false,"caseInsensitive":true}}],"ColReorder":[0,1,2,3,4,5,6,7,8,9,10],"childRows":[],"searchBuilder":{"criteria":[{"condition":"!=","data":"Pending Children","origData":"pendingChildren","type":"string","value":[" "]}],"logic":"AND"},"page":0,"stateRestore":{"isPredefined":false,"state":"Pending View","tableId":"award-person-table","isPreDefined":false},"c":{"_createInSaved":true,"create":true,"creationModal":true,"i18n":{"creationModal":{"button":"Create","colReorder":"Column Order","columns":{"search":"Column Search","visible":"Column Visibility"},"name":"Name:","order":"Sorting","paging":"Paging","scroller":"Scroll Position","search":"Search","searchBuilder":"SearchBuilder","searchPanes":"SearchPanes","select":"Select","title":"Create New State","toggleLabel":"Includes:"},"duplicateError":"A state with this name already exists.","emptyError":"Name cannot be empty.","emptyStates":"No saved states","removeConfirm":"Are you sure you want to remove %s?","removeError":"Failed to remove state.","removeJoiner":" and ","removeSubmit":"Remove","removeTitle":"Remove State","renameButton":"Rename","renameLabel":"New Name for %s:","renameTitle":"Rename State"},"modalCloseButton":true,"remove":true,"rename":true,"save":true,"saveState":{"colReorder":true,"columns":{"search":true,"visible":true},"order":true,"paging":true,"scroller":true,"search":true,"searchBuilder":true,"searchPanes":true,"select":true},"splitSecondaries":["updateState","removeState","renameState"],"toggle":{"colReorder":false,"columns":{"search":false,"visible":false},"order":false,"paging":false,"scroller":false,"search":false,"searchBuilder":false,"searchPanes":false,"select":false},"preDefined":{}}}</code></p>
]]>
        </description>
    </item>
    <item>
        <title>removeAllStates with savedStatesCreate</title>
        <link>https://next.datatables.net/forums/discussion/71954/removeallstates-with-savedstatescreate</link>
        <pubDate>Mon, 07 Mar 2022 19:43:17 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71954@/forums/discussions</guid>
        <description><![CDATA[<p>When I use the <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/alternative.html" title="Alternative UI">Alternative UI</a> for stateRestore, how can I add the <code>removeAllStates</code> <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/removeAll.html" title="Remove All Button">Remove All Button</a> inside the Alternative UI <code>savedStatesCreate</code>?</p>
]]>
        </description>
    </item>
    <item>
        <title>State Restore doesn't update show entries selection</title>
        <link>https://next.datatables.net/forums/discussion/71912/state-restore-doesnt-update-show-entries-selection</link>
        <pubDate>Thu, 03 Mar 2022 23:38:34 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71912@/forums/discussions</guid>
        <description><![CDATA[<p>You can use the simple example to test<br />
<a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/simple.html">https://datatables.net/extensions/staterestore/examples/initialisation/simple.html</a></p>

<p>Steps to test<br />
1) Set # rows displayed to 100<br />
2) Save a State<br />
3) Set # rows back to 10<br />
4) Switch to your saved state<br />
Notice there are now 100 rows displayed but the selection box still displays as  Show [10] Entries<br />
<img src="https://datatables.net/forums/uploads/editor/vn/e0ipwqkdzgh6.png" alt="" title="" /></p>
]]>
        </description>
    </item>
    <item>
        <title>Possible Bug: removeAllStates does not remove all states in stateRestore</title>
        <link>https://next.datatables.net/forums/discussion/71978/possible-bug-removeallstates-does-not-remove-all-states-in-staterestore</link>
        <pubDate>Wed, 09 Mar 2022 11:56:13 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71978@/forums/discussions</guid>
        <description><![CDATA[<p><code>removeAllStates</code> does not remove all states stored within stateRestore:</p>

<p>Example issue:</p>

<p>In the <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/removeAll.html" title="main example">Remove All Button example</a>:</p>

<p>1) sort Age, create state<br />
2) sort Office, create state<br />
3) sort Salary, create state<br />
Saved States will have 3 states saved<br />
4) Click on Remove All States</p>

<p>-&gt; State 2 still remains (Saved States button collection should be empty instead)</p>
]]>
        </description>
    </item>
    <item>
        <title>State Restore Documentation has broken links to view examples</title>
        <link>https://next.datatables.net/forums/discussion/71913/state-restore-documentation-has-broken-links-to-view-examples</link>
        <pubDate>Thu, 03 Mar 2022 23:45:47 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71913@/forums/discussions</guid>
        <description><![CDATA[<p>On the following page <a rel="nofollow" href="https://datatables.net/reference/option/stateRestore.saveState">https://datatables.net/reference/option/stateRestore.saveState</a></p>

<p>all of the "this example" links are 404 page not found.</p>

<p>Just a heads up.</p>
]]>
        </description>
    </item>
    <item>
        <title>Adding data item to state restore is breaking "Current Active" state</title>
        <link>https://next.datatables.net/forums/discussion/71828/adding-data-item-to-state-restore-is-breaking-current-active-state</link>
        <pubDate>Thu, 24 Feb 2022 20:21:42 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71828@/forums/discussions</guid>
        <description><![CDATA[<p>I don't know how to create a good test case for this so I would like to try to describe what I am doing and hope that it makes sense.</p>

<p>I am enhancing StateRestore with an ability to share the states to others by making it "public".</p>

<p>But I don't want public states to be modified by anyone other than the original creator.</p>

<p>I am close to making this work but I am having one issue I can't think of a way to resolve.</p>

<p>To implement this I add the owner of the state to the saved state data using     stateSaveParams.</p>

<pre><code> stateSaveParams: function (setting, data) {
      data.owner = _currentUser;
 }           
</code></pre>

<p>_currentUser is the login name of the user viewing the page.</p>

<p>I then modified the state buttons by adding an init function to hide the buttons to modify the state if the user is not the owner of the current state being initialized.</p>

<pre><code>function savedStateActionInit(dt, node, config) {
        var stateId = config.parent._stateRestore.s.identifier;
        if (config.parent._stateRestore.s.savedState.owner != _currentUser) {
            node.addClass('hidden-important');
        }
    }
</code></pre>

<p>This all works fine so I am almost successful implementing this feature.</p>

<p>The problem I have is that "Current Active States" thinks the state is not active when the user is NOT the owner.</p>

<p>I think this happens because "Current Active States" logic creates a temp saved state of the current view and compares it to each of the saved states to see which match.  Since the temp saved state will have a different "owner" value they will never match.  The temp will have the _currentUser as owner but the loaded state shared by someone else will have that person listed as the owner.</p>

<p>Is there a way I tell this logic to ignore the "owner" field when comparing the states to detect if a state is active?</p>
]]>
        </description>
    </item>
    <item>
        <title>For savedStatesCreate How can I modify the Button Text</title>
        <link>https://next.datatables.net/forums/discussion/71677/for-savedstatescreate-how-can-i-modify-the-button-text</link>
        <pubDate>Wed, 16 Feb 2022 00:40:31 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>Hon3yNutz</dc:creator>
        <guid isPermaLink="false">71677@/forums/discussions</guid>
        <description><![CDATA[<p>I currently am using the savedStatesCreate extension to group the save and restore state functionality in one button -- but i have been unsuccessful at renaming the button.  For the purposed of my team, we want to use save/load filter instead of save states ... is there any way to do this?</p>

<p>Also from a recommendation side of things, within this button, id recommend changing the css for div.dt-button-collection div.dt-btn-split-wrapper button.dt-button to include width: fit content and remove the pixel width on div.dt-button-collection (i set it to width: auto)  This way the saved states expand to show the full name.  Its not perfect but it works.</p>
]]>
        </description>
    </item>
    <item>
        <title>savedStatesCreate - Predefined searchBuilder State</title>
        <link>https://next.datatables.net/forums/discussion/71747/savedstatescreate-predefined-searchbuilder-state</link>
        <pubDate>Sat, 19 Feb 2022 02:44:10 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>Hon3yNutz</dc:creator>
        <guid isPermaLink="false">71747@/forums/discussions</guid>
        <description><![CDATA[<p>I would like to create a public predefined state for all users. I see the example for both <a rel="nofollow" href="https://datatables.net/extensions/searchbuilder/examples/api/rebuild.html" title="pulling and loading searchbuilder">pulling and loading searchbuilder</a> as well as <a rel="nofollow" href="https://editor.datatables.net/examples/extensions/searchBuilderPreDefined.html" title="predefined searchbuilder terms">predefined searchbuilder terms</a>.  It seems the predefined configuration item only allows usage of <a rel="nofollow" href="https://datatables.net/reference/option/stateRestore.preDefined" title="search">search</a> -- note the example on that page 404s</p>

<pre><code>  "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
    },
</code></pre>

<p>My code attempts to shoehorn searchbuilder into the predefined item but obviously fails...</p>

<pre><code>buttons:[
     extend: 'savedStatesCreate',
     config: {
          'saveState': {search: false},
          'creationModal': true,
          preDefined:{
              "Expires in 1 Year":{
                   searchBuilder: {
                        'criteria': [{
                            'condition': '&lt;',
                            'data' "expiration date",
                            'origData: 'ExpirationDate',
                            'type': 'date',
                            'value': ['2023-02-18']
                        ], logic: 'and'}
                   }
               }
          }
     }
]
</code></pre>

<p>I have a feeling the only way is to somehow set "expires in 1 year" to .searchBuilder.rebuild(stuff) -- where stuff is everything in criteria from above.  Am I on the right track here?</p>
]]>
        </description>
    </item>
    <item>
        <title>PHP files for stateRestore with Ajax Loading and Saving</title>
        <link>https://next.datatables.net/forums/discussion/71736/php-files-for-staterestore-with-ajax-loading-and-saving</link>
        <pubDate>Fri, 18 Feb 2022 16:36:43 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71736@/forums/discussions</guid>
        <description><![CDATA[<p>In the <a rel="nofollow" href="https://datatables.net/extensions/staterestore/examples/initialisation/ajax.html" title="stateRestore example for Ajax Loading and Saving">stateRestore example for Ajax Loading and Saving</a>, a php file is used for the Ajax data.</p>

<p>Would it be possible to look at these php files or their structure to understand how the data is delivered:</p>

<p><code>../data/stateRestoreLoad.php</code><br />
<code>../data/stateRestoreSave.php</code></p>

<p>Is there an example for them somewhere?</p>
]]>
        </description>
    </item>
    <item>
        <title>stateRestore Problem with searchBuilder and Custom Filter Buttons</title>
        <link>https://next.datatables.net/forums/discussion/71615/staterestore-problem-with-searchbuilder-and-custom-filter-buttons</link>
        <pubDate>Fri, 11 Feb 2022 12:08:13 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>trongart</dc:creator>
        <guid isPermaLink="false">71615@/forums/discussions</guid>
        <description><![CDATA[<p>Following from <a rel="nofollow" href="https://datatables.net/forums/discussion/70951/deactivating-filter-button-does-not-reset-search-filter#latest" title="this thread">this thread</a>, the test case below has custom filter buttons, stateSave, searchBuilder and the new stateRestore feature:</p>

<p><a rel="nofollow" href="http://live.datatables.net/jijufore/1/edit" title="live.datatables.net/jijufore/1/edit">live.datatables.net/jijufore/1/edit</a></p>

<p>I'm struggling with two issues:</p>

<p>1) The test case uses stateSave and when loading the page, searchBuilder conditions must not be loaded. This is done with <code>data.searchBuilder = {};</code> inside <code>stateLoadParams</code>. However, this seems to prevent stateRestore from loading all searchBuilder configurations. Only when <code>data.searchBuilder = {};</code> is commented out, stateRestore loads searchBuilder states. Is there a way not to load any searchBuilder conditions when loading the page while still being able to use stateRestore with searchBuilder?</p>

<p>2) stateRestore is not saving activated/deactivated custom filter buttons (filter1/filter2/filter3) although they are saved and loaded correctly when the page loads. Is it possible to save them with the states in stateRestore?</p>
]]>
        </description>
    </item>
    <item>
        <title>Possible to disable update/rename/remove options from predefined states?</title>
        <link>https://next.datatables.net/forums/discussion/71609/possible-to-disable-update-rename-remove-options-from-predefined-states</link>
        <pubDate>Fri, 11 Feb 2022 02:28:02 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>cuspenser</dc:creator>
        <guid isPermaLink="false">71609@/forums/discussions</guid>
        <description><![CDATA[<p>I have some predefined states in my application provided via ajax.  Is there an option to disable the update/rename/remove options from those predefined states while keeping them available for states an end user would create for themselves?  Basically, I don't want to confuse end users by making them think they can remove, for example, the predefined states when they would appear again on page load/reload.</p>

<p>Thank you for any guidance.  I'm really enjoying exploring the possibilities of stateRestore for our application.</p>
]]>
        </description>
    </item>
    <item>
        <title>All State Restore Saved States break if a column is added to a table</title>
        <link>https://next.datatables.net/forums/discussion/71523/all-state-restore-saved-states-break-if-a-column-is-added-to-a-table</link>
        <pubDate>Fri, 04 Feb 2022 19:41:42 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71523@/forums/discussions</guid>
        <description><![CDATA[<p>I suspected this would happen based on some of my observations about how State Restore behaves and with some testing I think I am correct in stating that all of a users "Saved States" stop working if a new column is introduced to a table.</p>

<p>Here is a simple test case to see the issue.<br />
<a rel="nofollow" href="http://live.datatables.net/gimanevi/1/edit?html,js,output">http://live.datatables.net/gimanevi/1/edit?html,js,output</a></p>

<p>Test scenario<br />
1) Open the test case and save a few states<br />
2) Uncomment out the three sections that say "Uncomment after creating a saved state"<br />
3) Try to switch to one of your saved states</p>

<p>This means any changes to my table Add Column, Remove Column and likely Rename Column would result in a user having to create all of their views again from scratch.<br />
Since I am using this in combination with Search Builder that could be considerable work for every user.</p>

<p>Would there be a way to fix this so it recognizes the column is new and does some default behavior to allow the saved state to work.    Then an update would include the new column making the saved state "correct" again.</p>
]]>
        </description>
    </item>
    <item>
        <title>State Restore's new save/rename/remove callback is only working for save when using server side post</title>
        <link>https://next.datatables.net/forums/discussion/71257/state-restores-new-save-rename-remove-callback-is-only-working-for-save-when-using-server-side-post</link>
        <pubDate>Fri, 14 Jan 2022 22:08:47 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>desperado</dc:creator>
        <guid isPermaLink="false">71257@/forums/discussions</guid>
        <description><![CDATA[<p>I am testing StateRestore 1.1.0 and Buttons 2.2.1 and have found a problem when using ajax state restore.</p>

<p>Here is my test case.   I flipped the logic from done to fail because I couldn't think of a way to get post to succeed without my actual server.</p>

<p><a rel="nofollow" href="http://live.datatables.net/cixelute/1/edit?js,console,output">http://live.datatables.net/cixelute/1/edit?js,console,output</a></p>

<p>Test Scenario<br />
You can see that each time my stateRestoreAjax method is called it attempts a post and on failure (make believe it was "done" success) it calls the callback();<br />
If you test save updates the dropdown list with the new "State 1" but attempt to remove or rename "State 1" will no be reflected correctly in the dropdown.</p>

<p>Test scenario<br />
1) Select "Saved States-&gt;Create State"<br />
2) Save "State 1"<br />
3) Note the dropdown get correctly updated with "State 1"<br />
4) Now try to rename or remove "State 1", the callback is called correctly (seen in console) but the dropdown is not updated.</p>

<p>Sorry if moving the "callback()" to fail is confusing but that was the only way I could get a simple test case to demonstrate the issue.    My actual code looks more like this.  See the comments starting with // ************** for my findings while testing</p>

<pre><code>            function stateRestoreAjax(data, callback) {
                // Action to take if loading states
                if (data.action === 'load') {
                    let url = _rcoiBaseUrl + "dataTablesView/getViews/" + _dataTableViewStoreDataTableId;
                    $.get(url, function (data, status) {
                        let cbData = {};
                        for (let i = 0; i &lt; data.length; i++) {
                            // Convert back from the string created when saving
                            cbData[data[i].identifier] = JSON.parse(data[i].state);
                        }
                        // Load states into StateRestore
                        console.log("starting callback");
                        _stateRestoreBlockSaveAjaxCall = true;
                        callback(cbData);
                        _stateRestoreBlockSaveAjaxCall = false;
                        console.log("Finished callback")
                    });
                }
                // Action to take if renaming states
                else if (data.action === 'rename') {
                    if (_stateRestoreBlockRenameAjaxCall) {
                        return;
                    }
                    // Get all of the state identifiers
                    var ids = Object.keys(data.stateRestore);
                    for (var i = 0; i &lt; ids.length; i++) {
                        let url = _rcoiBaseUrl + "dataTablesView/renameView";
                        let viewId = ids[i];
                        let newViewId = data.stateRestore[ids[i]];
                        let _viewSaveRequestData = {
                            'viewId': viewId,
                            'newViewId': newViewId,
                            'dataTableId': _dataTableViewStoreDataTableId
                        };
                        // This allows the post to pass the security token verification
                        // without this data you will get a 401 error
                        _viewSaveRequestData[_dt_sr_csrf_param_name] = _dt_sr_csrf_token; // Adds the token
                        console.log("Renaming");
                        $.post(url, _viewSaveRequestData).done(function () {
                            console.log("Rename View done, issuing callback");
                            callback();  // ********** THIS CALLBACK NOT WORKING *****************
                        }).fail(function () {
                            console.log("Rename Request Failed");
                            // Remove the state true prevents modal confirmation
                            alert("Sorry, rename view:'" + viewId + "' to '" + newViewId + "' failed, contact help desk if this condition persists.")
                        });
                    }
                }
                // Action to take if removing states
                else if (data.action === 'remove') {
                    if (_stateRestoreBlockRemoveAjaxCall) {
                        return;
                    }
                    var ids = Object.keys(data.stateRestore);
                    for (var i = 0; i &lt; ids.length; i++) {
                        let url = _rcoiBaseUrl + "dataTablesView/removeView";
                        let viewId = ids[i];
                        let viewData = data.stateRestore[ids[i]];
                        let _viewSaveRequestData = {
                            'viewId': viewId,
                            'dataTableId': _dataTableViewStoreDataTableId
                        };
                        // This allows the post to pass the security token verification
                        // without this data you will get a 401 error
                        _viewSaveRequestData[_dt_sr_csrf_param_name] = _dt_sr_csrf_token; // Adds the token
                        console.log("Removing " + viewId);
                        // callback();  // ******* CALLBACK HERE WORKS BUT THEN GETS CALLED EVEN ON FAIL
                        $.post(url, _viewSaveRequestData).done(function () {
                            console.log("Remove View done, issuing callback");
                            callback();  // ********** THIS CALLBACK NOT WORKING *****************
                        }).fail(function () {
                            console.log("Remove Request Failed");
                            alert("Sorry, view:'" + viewId + "' failed to remove, contact help desk if this condition persists.")
                        });
                    }
                }
                // Action to take if saving states
                else if (data.action === 'save') {
                    let ids = Object.keys(data.stateRestore);
                    if (_stateRestoreBlockSaveAjaxCall) {
                        // Fix issue with stateRestore calling save for every State when loading
                        console.log("Blocked Save on Load from State Restore");
                        callback();
                        return;
                    }
                    for (let i = 0; i &lt; ids.length; i++) {
                        let url = _rcoiBaseUrl + "dataTablesView/saveView";
                        let viewId = ids[i];
                        let viewData = JSON.stringify(data.stateRestore[ids[i]]);
                        let _viewSaveRequestData = {
                            'viewId': viewId,
                            'viewData': viewData,
                            'dataTableId': _dataTableViewStoreDataTableId
                        };
                        // This allows the post to pass the security token verification
                        // without this data you will get a 401 error
                        _viewSaveRequestData[_dt_sr_csrf_param_name] = _dt_sr_csrf_token; // Adds the token
                        console.log("Saving");
                        $.post(url, _viewSaveRequestData).done(function () {
                            console.log("Save View done, issuing callback");
                            callback();  // ******************* ONLY THIS CALL BACK FOR SAVE WORKS *******************/
                        }).fail(function () {
                            console.log("Save Request Failed");
                            alert("Sorry, view:'" + viewId + "' failed to save, contact help desk if this condition persists.")
                        });
                    }
                }
            }
</code></pre>
]]>
        </description>
    </item>
    <item>
        <title>Export/Import State</title>
        <link>https://next.datatables.net/forums/discussion/71304/export-import-state</link>
        <pubDate>Thu, 20 Jan 2022 16:10:14 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>ctml</dc:creator>
        <guid isPermaLink="false">71304@/forums/discussions</guid>
        <description><![CDATA[<p>With the new staterestore extension, do you think it's possible to create a custom button to export states (either all saved states, or the current one) and another to import state(s)?</p>

<p>The idea is that local browser storage isn't necessarily long lived and it can take a while to reconfigure states if that is lost, and the second use case would be for users to be able to share their states with others as it allows for quite complex setup of views which is great and being able to have one user share their setup might be quite helpful for others.</p>
]]>
        </description>
    </item>
    <item>
        <title>npm: Invalid tag name "&gt;=null"</title>
        <link>https://next.datatables.net/forums/discussion/71169/npm-invalid-tag-name-null</link>
        <pubDate>Thu, 06 Jan 2022 10:43:26 +0000</pubDate>
        <category>StateRestore</category>
        <dc:creator>aheritier</dc:creator>
        <guid isPermaLink="false">71169@/forums/discussions</guid>
        <description><![CDATA[<p>Hi team,</p>

<p>I am trying to use StateRestore with NPM and I don't succeed to install the BS4 module</p>

<p><strong>Link to test case</strong>: <code>npm install datatables.net-staterestore-bs4</code><br />
<strong>Debugger code (debug.datatables.net)</strong>: N/A<br />
<strong>Error messages shown</strong>:</p>

<pre><code>npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "&gt;=null": Tags may not have any characters that encodeURIComponent encodes.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/arnaud/.npm/_logs/2022-01-06T10_33_52_975Z-debug.log
</code></pre>

<p>And in the debug logs I have</p>

<pre><code>36 timing command:install Completed in 1255ms
37 verbose stack Error: Invalid tag name "&gt;=null": Tags may not have any characters that encodeURIComponent encodes.
37 verbose stack     at invalidTagName (/Users/arnaud/project/data/node/node_modules/npm/node_modules/npm-package-arg/npa.js:89:15)
37 verbose stack     at fromRegistry (/Users/arnaud/project/data/node/node_modules/npm/node_modules/npm-package-arg/npa.js:343:13)
37 verbose stack     at Function.resolve (/Users/arnaud/project/data/node/node_modules/npm/node_modules/npm-package-arg/npa.js:80:12)
37 verbose stack     at /Users/arnaud/project/data/node/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1034:38
37 verbose stack     at Array.map (&lt;anonymous&gt;)
37 verbose stack     at visit (/Users/arnaud/project/data/node/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:1033:56)
37 verbose stack     at visitNode (/Users/arnaud/project/data/node/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:57:25)
37 verbose stack     at next (/Users/arnaud/project/data/node/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:44:19)
37 verbose stack     at depth (/Users/arnaud/project/data/node/node_modules/npm/node_modules/treeverse/lib/depth-descent.js:82:10)
37 verbose stack     at depth (/Users/arnaud/project/data/node/node_modules/npm/node_modules/treeverse/lib/depth.js:27:12)
38 verbose cwd /Users/arnaud/project
39 verbose Darwin 21.2.0
40 verbose argv "/Users/arnaud/project/data/node/node" "/Users/arnaud/project/data/node/node_modules/npm/bin/npm-cli.js" "install" "datatables.net-staterestore-bs4"
41 verbose node v16.13.1
42 verbose npm  v8.1.2
43 error code EINVALIDTAGNAME
44 error Invalid tag name "&gt;=null": Tags may not have any characters that encodeURIComponent encodes.
45 verbose exit 1
</code></pre>

<p><strong>Description of problem</strong>:</p>

<p>It's impossible to install the node module <code>datatables.net-staterestore-bs4</code></p>

<p>Note: <code>datatables.net-staterestore</code> is ok</p>
]]>
        </description>
    </item>
   </channel>
</rss>
