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
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...