<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to remove searchmanager ID in mvc.js after a search in Splunk? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166818#M10251</link>
    <description>&lt;P&gt;Try this splunkjs.mvc.Components.revokeInstance("SEARCH MANAGER ID");&lt;/P&gt;</description>
    <pubDate>Wed, 18 Nov 2015 20:24:07 GMT</pubDate>
    <dc:creator>yxie_splunk</dc:creator>
    <dc:date>2015-11-18T20:24:07Z</dc:date>
    <item>
      <title>How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166812#M10245</link>
      <description>&lt;P&gt;I created a function in js and call it several times, however, once the searchmanager ID is used, the mvc.js will return an error the next time. As a result, I would like to know how can I remove the searchmanager object after search in Splunk?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;function ajax(id, ids) {

    var scope1 = new SearchManager({
        "id": "scope1",
        "status_buckets": 0,
        "search": "`GetSpecDeploylog("+id+")`",
        "app": utils.getCurrentApp()
    }, {
        tokens: true,
        tokenNamespace: "submitted"
    });

    var r = scope1.data('results');
    r.on('data', function(results) {
        BuildInfo(r.data().rows[0], '#build' + ids, [ids - 1]);
        DomainRun(r.data().rows[0], '#chart' + ids, '#legend' + ids);
    });

}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 20 Oct 2014 12:08:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166812#M10245</guid>
      <dc:creator>chrismok</dc:creator>
      <dc:date>2014-10-20T12:08:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166813#M10246</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I had the same problem. For a quick fix just remove the "id": "scope1" line completely. Looks like then automatically a unique id is generated with every call. I don't think this is the best method for the performance, but you can work on with your code.&lt;/P&gt;

&lt;P&gt;Greetings&lt;/P&gt;

&lt;P&gt;Tom&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 12:16:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166813#M10246</guid>
      <dc:creator>tom_frotscher</dc:creator>
      <dc:date>2014-10-20T12:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166814#M10247</link>
      <description>&lt;P&gt;Yes, currently I also generate the new key from "id". and for the r.on('data')...... I have to use the dirty method .....eval function to create the js script...... I hope splunk can provide the solution to us.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:26:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166814#M10247</guid>
      <dc:creator>chrismok</dc:creator>
      <dc:date>2014-10-20T15:26:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166815#M10248</link>
      <description>&lt;P&gt;Any solution for this problem?&lt;/P&gt;</description>
      <pubDate>Thu, 20 Aug 2015 07:03:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166815#M10248</guid>
      <dc:creator>kasu_praveen</dc:creator>
      <dc:date>2015-08-20T07:03:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166816#M10249</link>
      <description>&lt;P&gt;The solution is to create the search manager once, and then change the search of the existing search manager and start it again instead of creating a new search manager every time. It's a search manager after all, not a search.&lt;/P&gt;

&lt;P&gt;For the example from the question, it could look like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var scope1 = new SearchManager({
    "id" : "scope1",
    "status_buckets" : 0,
    "search" : "`GetSpecDeploylog(" + id + ")`",
    "app" : utils.getCurrentApp()
}, {
    tokens : true,
    tokenNamespace : "submitted"
});

var r = scope1.data('results');

r.on('data', function (results) {
    BuildInfo(r.data().rows[0], '#build' + ids, [ids - 1]);
    DomainRun(r.data().rows[0], '#chart' + ids, '#legend' + ids);
});

function ajax(id, ids) {
    scope1.settings.set("search", "new search string");
    scope1.startSearch();
}
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Aug 2015 10:30:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166816#M10249</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-08-20T10:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166817#M10250</link>
      <description>&lt;P&gt;This should work:  splunkjs.mvc.Components.revokeInstance("scope1").  After this, you can reuse the same id.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 20:22:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166817#M10250</guid>
      <dc:creator>yxie_splunk</dc:creator>
      <dc:date>2015-11-18T20:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to remove searchmanager ID in mvc.js after a search in Splunk?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166818#M10251</link>
      <description>&lt;P&gt;Try this splunkjs.mvc.Components.revokeInstance("SEARCH MANAGER ID");&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 20:24:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-remove-searchmanager-ID-in-mvc-js-after-a-search-in/m-p/166818#M10251</guid>
      <dc:creator>yxie_splunk</dc:creator>
      <dc:date>2015-11-18T20:24:07Z</dc:date>
    </item>
  </channel>
</rss>

