Dashboards & Visualizations

Disable a custom check cell based on value from another cell

dhtran
Loves-to-Learn Lots

Hello,

I have a table (simple XML) with a custom column to add a check button to select the rows and do some action on them.

Basically, the custom render looks like this

 

 

 

var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
          canRender: function(cell) {
              // Enable this custom cell renderer for Actions field
              return _(["Actions"]).contains(cell.field);
          },
          render: function($td, cell) {
              if (cell.field === "Actions") {
				$td.html('<label class="checkbox"><a href="#" class="btn customcheck"><i id="btnRadio" class="icon-check" style="display: none;"></i></a></label>');
              }
          }
		 
      });

 

 

 

Then of course I have the button on change listener, the action function etc. It works fine.

Once the action is applied, it changes a value of another field, let's say the Status field, from "Open" to "Close", something like this : 

Actions------IdCol------Status

chkbox---------AAA--------Open

chkbox--------BBB---------Close

chkbox--------CCC--------Open

This also works.

Now, I'd like to disable the checkbox on the rows having status=Close.

I've tried to access the rows and columns of the table through javascript using for exemple document.getElementById("#myTable"), looping on the cells value and adding "disabled" attribut, like this 

 

 

 

$(document).ready(function() {
var table = document.getElementById("myTable");
		for (var row = 0, n = table.rows.length; row < n; r++) {
			for (var col = 0, m = table.rows[row].cells.length; col < m; col++) {
				if(table.rows[row].cells[col].innerHTML == "Close") {
					table.rows[row].cells[0].setAttribute("disabled", true);
				}
			}
});

 

 

 

But since the table is rendered with Splunk component TableView, the document.getElementById() returned "undefined".

What is the correct way to achieve this ?

 

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

Developer Spotlight with Brett Adams

In our third Spotlight feature, we're excited to shine a light on Brett—a Splunk consultant, innovative ...

Index This | What can you do to make 55,555 equal 500?

April 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Say goodbye to manually analyzing phishing and malware threats with Splunk Attack ...

In today’s evolving threat landscape, we understand you’re constantly bombarded with phishing and malware ...