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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...