<?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 can I achieve a two level row expansions for a table view? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647092#M52914</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I tried the recent solution and it seems to be doing the one level expansion whereas I have the requirement to implement two level expansion. I have tried your previous solution on the same thread and got the two level expansion working. But the problem is,&lt;SPAN&gt;&amp;nbsp;it only works for the first row and that too only once and it does not roll up. For the rest of the rows it only expands to one level.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Jun 2023 06:03:28 GMT</pubDate>
    <dc:creator>deepikagooty</dc:creator>
    <dc:date>2023-06-15T06:03:28Z</dc:date>
    <item>
      <title>How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/643815#M52573</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I am currently working with the "row table expansion.js" from the dashboard examples. However, I am facing an issue where I can only achieve a single-level row expansion. My requirement is to have a two-level row expansion instead.&lt;/P&gt;
&lt;P&gt;Could you please assist me with achieving the desired two-level row expansion functionality? Thank you in advance.&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="deepikagooty_0-1684432822149.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/25447iD0BE9CF77682F4B1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="deepikagooty_0-1684432822149.png" alt="deepikagooty_0-1684432822149.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 May 2023 18:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/643815#M52573</guid>
      <dc:creator>deepikagooty</dc:creator>
      <dc:date>2023-05-18T18:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/643998#M52580</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245764"&gt;@deepikagooty&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this Sample JS Code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/chartview',
    'splunkjs/mvc/searchmanager',
    'splunkjs/mvc',
    'underscore',
    'splunkjs/mvc/simplexml/ready!'
], function(
    TableView,
    ChartView,
    SearchManager,
    mvc,
    _
) {
    console.log("HIe");
    var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
        canRender: function(cell) {
            return cell.field;
        },
        render: function($container, rowData) {
            console.log(rowData.value);
            $container.html(rowData.value)
        }
    });

    var EventSearchBasedRowExpansionRendererSecondLevel = TableView.BaseRowExpansionRenderer.extend({
        initialize: function(args) {
            this._searchManager = new SearchManager({
                preview: false
            }, { tokens: true, tokenNamespace: "submitted" });
            
            this._TableView = new TableView({
                managerid: this._searchManager.name,
                drilldown: 'cell'
            });
        },

        canRender: function(rowData) {
            return true;
        },

        render: function($container, rowData) {
            var processCell = _(rowData.cells).find(function(cell) {
                return cell.field === 'a';
            });

            value = processCell.value

            // var tokens = mvc.Components.get("default")
            this._searchManager.set({ search: '|makeresults count=100 | eval b="B", value="'+value+'",c=2 | accum c '});

            $container.append(this._TableView.render().el);
        }
    });

    var EventSearchBasedRowExpansionRenderer = TableView.BaseRowExpansionRenderer.extend({
        initialize: function(args) {
            this._searchManager = new SearchManager({
                preview: false
            }, { tokens: true, tokenNamespace: "submitted" });
            
            this._TableView = new TableView({
                managerid: this._searchManager.name,
                drilldown: 'cell'
            });

            this._TableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRendererSecondLevel());

        },

        canRender: function(rowData) {
            return true;
        },

        render: function($container, rowData) {
            var processCell = _(rowData.cells).find(function(cell) {
                return cell.field === 'Test Case';
            });

            value = processCell.value
            // var tokens = mvc.Components.get("default")
            // var id = tokens.get("splunk_id")
            this._searchManager.set({ search: '|makeresults count=100 | eval a="A", value="'+value+'",c=1 | accum c '});

            $container.append(this._TableView.render().el);
        }
    });

    var tableElement = mvc.Components.getInstance("expand_with_events");
    tableElement.getVisualization(function(tableView) {
        // Add custom cell renderer, the table will re-render automatically.
        tableView.table.addCellRenderer(new CustomRangeRenderer());
        tableView.render();
        tableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRenderer());
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;</description>
      <pubDate>Sat, 20 May 2023 05:37:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/643998#M52580</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2023-05-20T05:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/645185#M52668</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I tried the below mentioned solution. I am able to see the two level row expansion. However, it only works for the first row and that too only once and it does not roll up. For the rest of the rows it only expands to one level.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2023 03:26:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/645185#M52668</guid>
      <dc:creator>deepikagooty</dc:creator>
      <dc:date>2023-05-31T03:26:14Z</dc:date>
    </item>
    <item>
      <title>Re: How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647059#M52908</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;Can you please suggest a solution for this&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 22:59:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647059#M52908</guid>
      <dc:creator>deepikagooty</dc:creator>
      <dc:date>2023-06-14T22:59:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647087#M52912</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/245764"&gt;@deepikagooty&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below solution works for me. Can you please compare it with your code?&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;XML&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard script="expand_with_events.js" theme="dark" hideFilters="True"&amp;gt;
  &amp;lt;label&amp;gt;expand_with_events&amp;lt;/label&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;table id="table1"&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;| makeresults count=10 | eval count=1 | accum count | eval SID = count&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-1w@w1&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;@w1&amp;lt;/latest&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;row&amp;lt;/option&amp;gt;
        &amp;lt;option name="refresh.display"&amp;gt;progressbar&amp;lt;/option&amp;gt;
        &amp;lt;drilldown&amp;gt;
          &amp;lt;condition&amp;gt;&amp;lt;/condition&amp;gt;
        &amp;lt;/drilldown&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;JS&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/chartview',
    'splunkjs/mvc/searchmanager',
    'splunkjs/mvc',
    'underscore',
    'splunkjs/mvc/simplexml/ready!'
], function (
    TableView,
    ChartView,
    SearchManager,
    mvc,
    _
) {
    console.log("HIe");
    
    var EventSearchBasedRowExpansionRenderer = TableView.BaseRowExpansionRenderer.extend({
        initialize: function (args) {
            this._searchManager = new SearchManager({
                preview: false
            }, { tokens: true, tokenNamespace: "submitted" });

            this._TableView = new TableView({
                managerid: this._searchManager.name,
                drilldown: 'cell'
            });
        },

        canRender: function (rowData) {
            return true;
        },

        render: function ($container, rowData) {
            var processCell = _(rowData.cells).find(function (cell) {
                return cell.field === 'SID';
            });

            value = processCell.value
            
            this._searchManager.set({ search: '|makeresults count=100 | eval a="A", value="' + value + '",c=1 | accum c ' });

            $container.append(this._TableView.render().el);
        }
    });

    var tableElement = mvc.Components.getInstance("table1");
    tableElement.getVisualization(function (tableView) {
        
        tableView.addRowExpansionRenderer(new EventSearchBasedRowExpansionRenderer());
    });
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please check screenshot. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 05:20:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647087#M52912</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2023-06-15T05:20:44Z</dc:date>
    </item>
    <item>
      <title>Re: How can I achieve a two level row expansions for a table view?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647092#M52914</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I tried the recent solution and it seems to be doing the one level expansion whereas I have the requirement to implement two level expansion. I have tried your previous solution on the same thread and got the two level expansion working. But the problem is,&lt;SPAN&gt;&amp;nbsp;it only works for the first row and that too only once and it does not roll up. For the rest of the rows it only expands to one level.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Jun 2023 06:03:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-can-I-achieve-a-two-level-row-expansions-for-a-table-view/m-p/647092#M52914</guid>
      <dc:creator>deepikagooty</dc:creator>
      <dc:date>2023-06-15T06:03:28Z</dc:date>
    </item>
  </channel>
</rss>

