<?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 Checkbox not getting enabled on change in token value in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Checkbox-not-getting-enabled-on-change-in-token-value/m-p/520319#M9308</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I have javascript code of which job is to check checkboxes on change in token value:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is for rendering of the checkbox:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
             return _(['Check for Prediction']).contains(cell.field);
         },
         render: function($td, cell) {
             
             var a = $('&amp;lt;div&amp;gt;').attr({"id":"chk-sourcetype"+cell.value,"value":cell.value}).addClass('checkbox').click(function() {
                 
                 if($(this).attr('class')==="checkbox")
                 {
                     selected_values_array.push($(this).attr('value'));
                     $(this).removeClass();
                     $(this).addClass("checkbox checked");
                 }
                 else {
                     $(this).removeClass();
                     $(this).addClass("checkbox");
                     var i = selected_values_array.indexOf($(this).attr('value'));
                     if(i != -1) {
                         selected_values_array.splice(i, 1);
                     }
                     // Change the value of a token $mytoken$
                 }
                    
                 
                    //console.log(val_arr[1]);
                 console.log(selected_values_array);
             }).appendTo($td);

                
             
         }
     });​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is my on change condition:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;tokens.on("change:mytoken2", function() {
        tokenVal=tokens.get("mytoken2");
        console.log("mytoken2onchange: " + tokenVal);
        if (tokenVal=='value changed') {

            console.log('inside on:change...')
        var tableIDs = ["myTable"];
        
        for (i=0;i&amp;lt;tableIDs.length;i++) {
            var sh = mvc.Components.get(tableIDs[i]);
            // console.log(sh)
            if(typeof(sh)!="undefined") {
                sh.getVisualization(function(tableView) {
                    // Add custom cell renderer and force re-render
                    tableView.table.addCellRenderer(new CustomRangeRenderer());
                    tableView.table.render();
                });
            }
        }
     }
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;This is default:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Screenshot 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 1.png" style="width: 154px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10886i9AEB7E48D7932AA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 1.png" alt="Screenshot 1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And on click of a button, there will be change in token value and as a result of which the column 'Selected' whereever value is 'Yes', the checkbox corresponding to that row must get enabled:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Screenshot 2&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2.png" style="width: 206px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10885i05613100147AE03E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2.png" alt="Screenshot 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please feel free to shoot your questions if anything is not clear.&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>Fri, 18 Sep 2020 12:39:21 GMT</pubDate>
    <dc:creator>its_shubham</dc:creator>
    <dc:date>2020-09-18T12:39:21Z</dc:date>
    <item>
      <title>Checkbox not getting enabled on change in token value</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Checkbox-not-getting-enabled-on-change-in-token-value/m-p/520319#M9308</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have javascript code of which job is to check checkboxes on change in token value:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;This is for rendering of the checkbox:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var CustomRangeRenderer = TableView.BaseCellRenderer.extend({
         canRender: function(cell) {
             return _(['Check for Prediction']).contains(cell.field);
         },
         render: function($td, cell) {
             
             var a = $('&amp;lt;div&amp;gt;').attr({"id":"chk-sourcetype"+cell.value,"value":cell.value}).addClass('checkbox').click(function() {
                 
                 if($(this).attr('class')==="checkbox")
                 {
                     selected_values_array.push($(this).attr('value'));
                     $(this).removeClass();
                     $(this).addClass("checkbox checked");
                 }
                 else {
                     $(this).removeClass();
                     $(this).addClass("checkbox");
                     var i = selected_values_array.indexOf($(this).attr('value'));
                     if(i != -1) {
                         selected_values_array.splice(i, 1);
                     }
                     // Change the value of a token $mytoken$
                 }
                    
                 
                    //console.log(val_arr[1]);
                 console.log(selected_values_array);
             }).appendTo($td);

                
             
         }
     });​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;This is my on change condition:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;tokens.on("change:mytoken2", function() {
        tokenVal=tokens.get("mytoken2");
        console.log("mytoken2onchange: " + tokenVal);
        if (tokenVal=='value changed') {

            console.log('inside on:change...')
        var tableIDs = ["myTable"];
        
        for (i=0;i&amp;lt;tableIDs.length;i++) {
            var sh = mvc.Components.get(tableIDs[i]);
            // console.log(sh)
            if(typeof(sh)!="undefined") {
                sh.getVisualization(function(tableView) {
                    // Add custom cell renderer and force re-render
                    tableView.table.addCellRenderer(new CustomRangeRenderer());
                    tableView.table.render();
                });
            }
        }
     }
​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;SPAN&gt;This is default:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Screenshot 1&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 1.png" style="width: 154px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10886i9AEB7E48D7932AA4/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 1.png" alt="Screenshot 1.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And on click of a button, there will be change in token value and as a result of which the column 'Selected' whereever value is 'Yes', the checkbox corresponding to that row must get enabled:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Screenshot 2&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2.png" style="width: 206px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/10885i05613100147AE03E/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2.png" alt="Screenshot 2.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please feel free to shoot your questions if anything is not clear.&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>Fri, 18 Sep 2020 12:39:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Checkbox-not-getting-enabled-on-change-in-token-value/m-p/520319#M9308</guid>
      <dc:creator>its_shubham</dc:creator>
      <dc:date>2020-09-18T12:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Checkbox not getting enabled on change in token value</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Checkbox-not-getting-enabled-on-change-in-token-value/m-p/520490#M9309</link>
      <description>&lt;P&gt;share simple xml.&lt;/P&gt;</description>
      <pubDate>Sun, 20 Sep 2020 12:23:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Checkbox-not-getting-enabled-on-change-in-token-value/m-p/520490#M9309</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-20T12:23:40Z</dc:date>
    </item>
  </channel>
</rss>

