<?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 Running a base search from SplunkJS in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Running-a-base-search-from-SplunkJS/m-p/204557#M2739</link>
    <description>&lt;P&gt;&amp;nbsp;Hi,&lt;/P&gt;

&lt;P&gt;I'm writing a dashboard with some panels based off an expanding table rows from the Splunk Dashboard 6.x examples app.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1241iDCE8BC57CF56513B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Code as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([ ... ){
    var EventSearchBasedRowExpansionRenderer = TableView.BaseRowExpansionRenderer.extend({
        initialize: function(args) {
            this._searchManager = new SearchManager({
                id: 'details-search-manager',
                preview: false
            });
            this._chartView = new ChartView({
                managerid: 'details-search-manager',
                'charting.legend.placement': 'none'
            });
        },
        canRender: function(rowData) {
            return true;
        },
        render: function($container, rowData) {
            var sourcetypeCell = _(rowData.cells).find(function (cell) {
               return cell.field === 'sourcetype';
            });
            this._searchManager.set({ search: 'index=_internal sourcetype=' + sourcetypeCell.value + ' | timechart count'});
            $container.append(this._chartView.render().el);
        }
    });
    var tableElement = mvc.Components.getInstance("expand_with_events");
    tableElement.getVisualization(function(tableView) {
        tableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRenderer());
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This all works very nice. What I really need though is to be able to access my base search for the dashboard I've written from javascript, and run my searchManager using that (with my customised search appended), if at all possible.&lt;/P&gt;

&lt;P&gt;Hope this makes sense? Any suggestions are appreciated, I'll keep digging through the developer doco in the meantime.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Ollie&lt;/P&gt;</description>
    <pubDate>Sat, 16 Apr 2016 17:39:20 GMT</pubDate>
    <dc:creator>ollie920049</dc:creator>
    <dc:date>2016-04-16T17:39:20Z</dc:date>
    <item>
      <title>Running a base search from SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Running-a-base-search-from-SplunkJS/m-p/204557#M2739</link>
      <description>&lt;P&gt;&amp;nbsp;Hi,&lt;/P&gt;

&lt;P&gt;I'm writing a dashboard with some panels based off an expanding table rows from the Splunk Dashboard 6.x examples app.&lt;/P&gt;

&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="alt text"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/1241iDCE8BC57CF56513B/image-size/large?v=v2&amp;amp;px=999" role="button" title="alt text" alt="alt text" /&gt;&lt;/span&gt;&lt;/P&gt;

&lt;P&gt;Code as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([ ... ){
    var EventSearchBasedRowExpansionRenderer = TableView.BaseRowExpansionRenderer.extend({
        initialize: function(args) {
            this._searchManager = new SearchManager({
                id: 'details-search-manager',
                preview: false
            });
            this._chartView = new ChartView({
                managerid: 'details-search-manager',
                'charting.legend.placement': 'none'
            });
        },
        canRender: function(rowData) {
            return true;
        },
        render: function($container, rowData) {
            var sourcetypeCell = _(rowData.cells).find(function (cell) {
               return cell.field === 'sourcetype';
            });
            this._searchManager.set({ search: 'index=_internal sourcetype=' + sourcetypeCell.value + ' | timechart count'});
            $container.append(this._chartView.render().el);
        }
    });
    var tableElement = mvc.Components.getInstance("expand_with_events");
    tableElement.getVisualization(function(tableView) {
        tableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRenderer());
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This all works very nice. What I really need though is to be able to access my base search for the dashboard I've written from javascript, and run my searchManager using that (with my customised search appended), if at all possible.&lt;/P&gt;

&lt;P&gt;Hope this makes sense? Any suggestions are appreciated, I'll keep digging through the developer doco in the meantime.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
Ollie&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2016 17:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Running-a-base-search-from-SplunkJS/m-p/204557#M2739</guid>
      <dc:creator>ollie920049</dc:creator>
      <dc:date>2016-04-16T17:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Running a base search from SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Running-a-base-search-from-SplunkJS/m-p/204558#M2740</link>
      <description>&lt;P&gt;To use your base search, you should use the &lt;CODE&gt;postprocessmanager&lt;/CODE&gt; and not the &lt;CODE&gt;searchamanger&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_postprocessmanager.html"&gt;http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_postprocessmanager.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Apr 2016 20:27:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Running-a-base-search-from-SplunkJS/m-p/204558#M2740</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-04-16T20:27:38Z</dc:date>
    </item>
  </channel>
</rss>

