Dashboards & Visualizations

Why am I getting error "addRowExpansionRenderer is not a function" in the JavaScript web framework after upgrade to Splunk 6.3 from 6.2.4?

ConnorG
Path Finder

After upgrading to Splunk 6.3, it seems the previous web framework for Javascript does not work properly.

My jscript is getting a TypeError: tableView.table.addRowExpansionRenderer is not a function error when being run under a 6.3 instance.

The code I'm using is expanding upon the concepts provides here

Anyone know if there were changes to the web framework and how to accommodate those changes?

0 Karma
1 Solution

ConnorG
Path Finder

I fixed it after referencing the example dashboards app. Below you can find my code.

6.2.4 code:

var tables = ['web_stat_page_tbl', 'web_diag_tran_tbl', 'web_diag_comp_tbl', 'web_stat_tran_tbl'];

    for(i = 0; i < tables.length; i++) {
        mvc.Components.get(tables[i]).getVisualization(function(tableView) {
            // Add custom cell renderer
            tableView.table.addCellRenderer(new CustomRangeRenderer());
            // Add custom row renderer
            tableView.table.addRowExpansionRenderer(new CustomRowRenderer());

            // Force the table to re-render
            tableView.table.render();
        });
    } 

6.3.0 code:

    var tableElement = mvc.Components.getInstance("web_stat_page_tbl");
    tableElement.getVisualization(function(tableView) {
        // Add custom cell renderer, the table will re-render automatically.
        tableView.addCellRenderer(new CustomRangeRenderer());
        tableView.addRowExpansionRenderer(new CustomRowRenderer());
    });

View solution in original post

ConnorG
Path Finder

I fixed it after referencing the example dashboards app. Below you can find my code.

6.2.4 code:

var tables = ['web_stat_page_tbl', 'web_diag_tran_tbl', 'web_diag_comp_tbl', 'web_stat_tran_tbl'];

    for(i = 0; i < tables.length; i++) {
        mvc.Components.get(tables[i]).getVisualization(function(tableView) {
            // Add custom cell renderer
            tableView.table.addCellRenderer(new CustomRangeRenderer());
            // Add custom row renderer
            tableView.table.addRowExpansionRenderer(new CustomRowRenderer());

            // Force the table to re-render
            tableView.table.render();
        });
    } 

6.3.0 code:

    var tableElement = mvc.Components.getInstance("web_stat_page_tbl");
    tableElement.getVisualization(function(tableView) {
        // Add custom cell renderer, the table will re-render automatically.
        tableView.addCellRenderer(new CustomRangeRenderer());
        tableView.addRowExpansionRenderer(new CustomRowRenderer());
    });

ConnorG
Path Finder

Sticking to the old format would give us:

    var tables = ['web_stat_page_tbl', 'web_diag_tran_tbl', 'web_diag_comp_tbl', 'web_stat_tran_tbl'];

    for(i = 0; i < tables.length; i++) {
        mvc.Components.get(tables[i]).getVisualization(function(tableView) {
            // Add custom cell renderer
            tableView.addCellRenderer(new CustomRangeRenderer());
            // Add custom row renderer
            tableView.addRowExpansionRenderer(new CustomRowRenderer());

        });
    } 
0 Karma

ConnorG
Path Finder

Below is the table object in a debug view coming from Splunk 6.2.4. Here we can see the addRowExpansionRenderer is still listed under the object.
alt text

Here is the same object in 6.3. No mention of RowExpansionRenderer anywhere.
alt text

0 Karma
Get Updates on the Splunk Community!

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...