<?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 Changing multiple tables in SimpleXML using SplunkJS in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110595#M1636</link>
    <description>&lt;P&gt;I need to be able to modify the behavior of any number of tables on a dashboard created with SimpleXML. I have my custom JavaScript added to the page and running properly. I am using mvc.Components.getInstances() to get a full list of all components on the page, and this is working as expected. Also, I'm using splunkjs/mvc/simplexml/ready! as a dependency so that my JavaScript executes after everything is ready. And I should mention that I'm using getInstances() instead of getInstance() because I want the behavior to be generic for any number of tables.&lt;/P&gt;

&lt;P&gt;Here's where the problem is. When I iterate through my instances returned by getInstances(), certain properties are not yet available. Specifically, since I am trying to manipulate tables on the dashboard, I am unable to access the visualization member as it's NULL at the time my code is running. What is the proper way to manipulate a SimpleXML table after it's fully loaded? And another related question, is there an easy way to determine if an object returned by getInstances() is specifically a table without looking for a specific property?&lt;/P&gt;

&lt;P&gt;Thanks for any help.&lt;/P&gt;</description>
    <pubDate>Fri, 28 Mar 2014 01:15:59 GMT</pubDate>
    <dc:creator>pgullette</dc:creator>
    <dc:date>2014-03-28T01:15:59Z</dc:date>
    <item>
      <title>Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110595#M1636</link>
      <description>&lt;P&gt;I need to be able to modify the behavior of any number of tables on a dashboard created with SimpleXML. I have my custom JavaScript added to the page and running properly. I am using mvc.Components.getInstances() to get a full list of all components on the page, and this is working as expected. Also, I'm using splunkjs/mvc/simplexml/ready! as a dependency so that my JavaScript executes after everything is ready. And I should mention that I'm using getInstances() instead of getInstance() because I want the behavior to be generic for any number of tables.&lt;/P&gt;

&lt;P&gt;Here's where the problem is. When I iterate through my instances returned by getInstances(), certain properties are not yet available. Specifically, since I am trying to manipulate tables on the dashboard, I am unable to access the visualization member as it's NULL at the time my code is running. What is the proper way to manipulate a SimpleXML table after it's fully loaded? And another related question, is there an easy way to determine if an object returned by getInstances() is specifically a table without looking for a specific property?&lt;/P&gt;

&lt;P&gt;Thanks for any help.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Mar 2014 01:15:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110595#M1636</guid>
      <dc:creator>pgullette</dc:creator>
      <dc:date>2014-03-28T01:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110596#M1637</link>
      <description>&lt;P&gt;Curious to see if you figured out a solution to this problem.&lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 07 Nov 2014 20:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110596#M1637</guid>
      <dc:creator>spongmob</dc:creator>
      <dc:date>2014-11-07T20:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110597#M1638</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;var libs = [
    "jquery",
    "splunkjs/mvc",
    "splunkjs/mvc/simplexml/element/table",
    "splunkjs/mvc/simplexml/ready!",
];

require(libs, function ($, mvc, TableElement) {
    "use strict";

    $.each(mvc.Components.getInstances(), function (i, view) {
        /**
         *  @author Marco Sulla (marcosullaroma@gmail.com)
         *  @date Jan 31, 2015
         */

        if (view instanceof TableElement) {
            view.getVisualization(function (view) {
                view.on("rendered", function () {
                    console.log(view);
                 });
            });
        }
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sources:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/WebFramework"&gt;Web Framework Reference&lt;/A&gt;&lt;BR /&gt;
&lt;A href="https://apps.splunk.com/app/1603/"&gt;Examples App&lt;/A&gt;&lt;BR /&gt;
&lt;CODE&gt;share/splunk/search_mrsparkle/exposed/js/build/simplexml/mvc.js&lt;/CODE&gt; source code&lt;/P&gt;</description>
      <pubDate>Sun, 14 Dec 2014 14:22:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110597#M1638</guid>
      <dc:creator>marco_sulla</dc:creator>
      <dc:date>2014-12-14T14:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110598#M1639</link>
      <description>&lt;P&gt;Did you find a solution? I would also like to address all Tables (unknown ids).&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 17:23:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110598#M1639</guid>
      <dc:creator>helenashton</dc:creator>
      <dc:date>2015-01-20T17:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110599#M1640</link>
      <description>&lt;P&gt;So we started off running a loop finding ".table.splunk-view".each". We were then able to get the attribute "id" of each instance. From there we went about it in a similar manner as Marco's solution below by plugging in the id we gathered in the previous step. &lt;/P&gt;

&lt;P&gt;Hope this helps!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 18:21:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110599#M1640</guid>
      <dc:creator>spongmob</dc:creator>
      <dc:date>2015-01-20T18:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: Changing multiple tables in SimpleXML using SplunkJS</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110600#M1641</link>
      <description>&lt;P&gt;It does (that's exactly what I am trying to do), but it would be great if you could share that snippet of code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jan 2015 18:28:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Changing-multiple-tables-in-SimpleXML-using-SplunkJS/m-p/110600#M1641</guid>
      <dc:creator>helenashton</dc:creator>
      <dc:date>2015-01-20T18:28:44Z</dc:date>
    </item>
  </channel>
</rss>

