Splunk Dev

Splunk Modal window with tableview rendered

spammenot66
Contributor

I'm trying to get my dashboard to show a modal window with a tableview containing search assigned to the tableview.  The tableview search is not to show search with updated token value. 

 

 

 

<row>
    <panel>
      <title>$show_ModalTable$</title>
      <chart>
        <search>
          <query>index=_internal sourcetype="splunkd" log_level IN ("ERROR", "WARN")|stats count by component</query>
          <earliest>-60m@m</earliest>
          <latest>now</latest>
        </search>
        <option name="refresh.display">progressbar</option>
        <drilldown>
          <set token="show_ModalTable">$row.component$</set>
        </drilldown>
      </chart>
    </panel>
    <panel>
      <html>
        <div class="modal hide fade" id="modaltable_div">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true"/>
            <h3>Modal header</h3>
        </div>
        <div id="modaltable_detail"/>
        <!--<div class="modal-footer">
            <a href="#" class="btn">Close</a>
            <a href="#" class="btn btn-primary">Save changes</a>
        </div>-->
        </div>
      </html>
    </panel>
  </row>
require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/searchmanager',
    'splunkjs/mvc/searchcontrolsview',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/chartview',
    'splunkjs/mvc/simplexml/ready!'
], function(_, $, mvc, SavedSearchManager, SearchControlsView, TableView, ChartView) {
	
	// Listen for token changesvar 
	tokens = mvc.Components.get("default");
    var tv= new TableView({
        id: 'modal_table',
        data: "results" ,
        managerid: 'modaltable_search',
        el: $('#modaltable_detail')
    }).render();

	tokens.on("change:show_ModalTable", function(model, value, options) {
		$('#modaltable_div').modal();
		//mvc.Components.revokeInstance("modal_table");
		var sm = mvc.Components.getInstance("modaltable_search");
        
        sm.startSearch();
        console.log(sm.settings.get("search"))
        
	});
});

 

 

 

 

 

 

 

Labels (3)
Tags (2)
0 Karma
Get Updates on the Splunk Community!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...