<?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 use Javascript in creating tables? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151389#M42427</link>
    <description>&lt;P&gt;Thanks. It works!&lt;/P&gt;</description>
    <pubDate>Mon, 03 Aug 2015 06:33:07 GMT</pubDate>
    <dc:creator>josefa123</dc:creator>
    <dc:date>2015-08-03T06:33:07Z</dc:date>
    <item>
      <title>How to use Javascript in creating tables?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151387#M42425</link>
      <description>&lt;P&gt;Here is my XML in Splunk Web&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;dashboard script="yeahboy.js"&amp;gt;
  &amp;lt;label&amp;gt;Sample Dashboard&amp;lt;/label&amp;gt;
&amp;lt;/dashboard&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And this is my Javascript code&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;/**
 * Created by micoh on 7/29/2015.
 */
require(["splunkjs/ready!"], function(mvc) {
    var deps = [
        "jquery",
        "splunkjs/ready!",
        "splunkjs/mvc/searchmanager",
        "splunkjs/mvc/tableview"
    ];
    require(deps, function(mvc) {
        var SearchManager = require("splunkjs/mvc/searchmanager");
        new SearchManager({
            id: "search1",
            earliest_time: "rt-1w",
            latest_time: "rtnow",
            search: "* | bucket _time span=1m | stats values(memUsedPct) by host _time",
            preview: true,
            autostart: true,
            cache: true

        });
        var TableView = require('splunkjs/mvc/tableview');
        var element1 = new TableView({
            id: "element1",
            count: 10,
            dataOverlayMode: "none",
            drilldown: "cell",
            rowNumbers: "false",
            wrap: "true",
            managerid: "search1",
            el: $("#myTable")
        });
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is my dashboard&lt;/P&gt;

&lt;P&gt;&lt;IMG src="http://i.imgur.com/91mufxy.png" alt="alt text" /&gt;&lt;/P&gt;

&lt;P&gt;I am new on using SplunkJS. I've researched on how to use it to create tables and I think I have a correct code.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 04:29:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151387#M42425</guid>
      <dc:creator>josefa123</dc:creator>
      <dc:date>2015-08-03T04:29:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Javascript in creating tables?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151388#M42426</link>
      <description>&lt;P&gt;Everything is looking good so far, but you are missing the link that tells splunk where to put your table. In javascript, you instructed the TableView to use the element &lt;CODE&gt;#mytable&lt;/CODE&gt; for its position, but there is no such thing in you Simple XML. Adding these three lines below your label tag should do it:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;row&amp;gt;
  &amp;lt;panel&amp;gt;
    &amp;lt;html&amp;gt;
      &amp;lt;div id="myTable"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/html&amp;gt;
  &amp;lt;/panel&amp;gt;
&amp;lt;/row&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Aug 2015 06:03:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151388#M42426</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-08-03T06:03:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Javascript in creating tables?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151389#M42427</link>
      <description>&lt;P&gt;Thanks. It works!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Aug 2015 06:33:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-use-Javascript-in-creating-tables/m-p/151389#M42427</guid>
      <dc:creator>josefa123</dc:creator>
      <dc:date>2015-08-03T06:33:07Z</dc:date>
    </item>
  </channel>
</rss>

