<?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 Re: js for button on table cell in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676532#M18584</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I appreciate your help very much&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 06:10:55 GMT</pubDate>
    <dc:creator>willtseng0217</dc:creator>
    <dc:date>2024-02-05T06:10:55Z</dc:date>
    <item>
      <title>js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676502#M18580</link>
      <description>&lt;P&gt;Dear Splunkers ,&amp;nbsp;&lt;BR /&gt;May I ask for help please~&lt;BR /&gt;&lt;BR /&gt;I have a dashboard like below , I need someone give me some suggestion , to add a button on action fields&lt;BR /&gt;when button clicked, then change the status filed content to "Ack"&lt;BR /&gt;&lt;BR /&gt;thank u all ,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;dashboard version="1.1" theme="dark" script="test.js"&amp;gt;&lt;BR /&gt;&amp;lt;label&amp;gt;111&amp;lt;/label&amp;gt;&lt;BR /&gt;&amp;lt;row&amp;gt;&lt;BR /&gt;&amp;lt;panel&amp;gt;&lt;BR /&gt;&amp;lt;table&amp;gt;&lt;BR /&gt;&amp;lt;search&amp;gt;&lt;BR /&gt;&amp;lt;query&amp;gt;|makeresults count=5 | eval A=random(), B=random(), status="", action="Ack/UnAck"&amp;lt;/query&amp;gt;&lt;BR /&gt;&amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;&lt;BR /&gt;&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;&lt;BR /&gt;&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;&lt;BR /&gt;&amp;lt;/search&amp;gt;&lt;BR /&gt;&amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;&lt;BR /&gt;&amp;lt;/table&amp;gt;&lt;BR /&gt;&amp;lt;/panel&amp;gt;&lt;BR /&gt;&amp;lt;/row&amp;gt;&lt;BR /&gt;&amp;lt;/dashboard&amp;gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 15:50:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676502#M18580</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-04T15:50:50Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676503#M18581</link>
      <description>&lt;P&gt;I would like to use the test.js to do this , try to ask for ChatGPT but can't done my job...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 15:52:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676503#M18581</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-04T15:52:41Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676530#M18582</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103733"&gt;@willtseng0217&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try XML and js below?&lt;/P&gt;&lt;P&gt;XML&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard version="1.1" theme="dark" script="test.js"&amp;gt;
	&amp;lt;label&amp;gt;js for button on table cell&amp;lt;/label&amp;gt;
	&amp;lt;row&amp;gt;
		&amp;lt;panel&amp;gt;
			&amp;lt;table id="table1"&amp;gt;
				&amp;lt;search&amp;gt;
					&amp;lt;query&amp;gt;|makeresults count=5 | eval A=random(), B=random(), status=A, action=A&amp;lt;/query&amp;gt;
					&amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
					&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
					&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
				&amp;lt;/search&amp;gt;
				&amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
				&amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
				&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
				&amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
			&amp;lt;/table&amp;gt;
		&amp;lt;/panel&amp;gt;
	&amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;test.js&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, TableView) {
    console.log("Hie 2");
    var CustomCellRenderer = TableView.BaseCellRenderer.extend({
        canRender: function (cell) {
            // Enable this custom cell renderer for the confirm field
            return _(["action", "status"]).contains(cell.field);
        },
        render: function ($td, cell) {
            if (cell.field == "action") {
                let unique_id = cell.value;
                let button_id = "action_btn_" + unique_id;
                let div_id = "status_div_" + unique_id;

                let button = $('&amp;lt;button /&amp;gt;', {
                    value: 'Ack',
                    id: button_id,
                    on: {
                        click: function () {
                            console.log(unique_id, button_id);
                            console.log(div_id);
                            let div_value = $('#' + div_id).html();
                            if (div_value == "Ack") {
                                $('#' + div_id).html("Unack");
                                $('#' + button_id).html("Ack");

                            } else {
                                $('#' + div_id).html("Ack");
                                $('#' + button_id).html("Unack");
                            }
                        }
                    }
                }).addClass("extend_expiry btn-sm btn btn-primary").html("Ack");
                $td.html(button)
            }
            if (cell.field == "status") {
                let div_id = "status_div_" + cell.value;
                let html = `&amp;lt;div id="` + div_id + `"&amp;gt;&amp;lt;/div&amp;gt;`
                $td.html(html)
            }
        }
    });

    var sh = mvc.Components.get("table1");
    if (typeof (sh) != "undefined") {
        sh.getVisualization(function (tableView) {
            // Add custom cell renderer and force re-render
            tableView.table.addCellRenderer(new CustomCellRenderer());
            tableView.table.render();
        });
    }
});&lt;/LI-CODE&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;&lt;P&gt;Screenshot&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-02-05 at 11.33.45 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29234i7FBBD0C1FC969E31/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-02-05 at 11.33.45 AM.png" alt="Screenshot 2024-02-05 at 11.33.45 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Note: Just change the code as per your logic and feel free to ask.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:05:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676530#M18582</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-02-05T06:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676531#M18583</link>
      <description>&lt;P&gt;Now you can try Chat GTP. it will give this answer only.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":winking_face_with_tongue:"&gt;😜&lt;/span&gt; &lt;span class="lia-unicode-emoji" title=":rolling_on_the_floor_laughing:"&gt;🤣&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:06:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676531#M18583</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-02-05T06:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676532#M18584</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I appreciate your help very much&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":smiling_face_with_heart_eyes:"&gt;😍&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:10:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676532#M18584</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-05T06:10:55Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676534#M18585</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Sir&amp;nbsp;&lt;BR /&gt;really thank for response so quickly&lt;/P&gt;&lt;P&gt;May I Know , is that possible to keep status field content when dashboard refresh ?&lt;BR /&gt;for example ,&amp;nbsp;&lt;BR /&gt;when I click that button , write _time, a , b , status to the lookup table or something,&amp;nbsp;&lt;BR /&gt;once dashboard refresh , I can lookup that and keep this status content alive&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:25:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676534#M18585</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-05T06:25:05Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676535#M18586</link>
      <description>&lt;P&gt;Yes&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103733"&gt;@willtseng0217&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can store data KV store. You have to just take care of a couple of things.&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;create a lookup with a unique ID that can be used for updating records.&lt;/LI&gt;&lt;LI&gt;call KVStore API with the click of a button.&lt;/LI&gt;&lt;LI&gt;&amp;nbsp;display status and action button value as per the KV Store.&amp;nbsp;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you to move further &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:38:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676535#M18586</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-02-05T06:38:36Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676536#M18587</link>
      <description>&lt;P&gt;Check this post for more technical details.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-dynamic-checkbox-in-table/m-p/635091" target="_blank"&gt;https://community.splunk.com/t5/Dashboards-Visualizations/How-to-use-dynamic-checkbox-in-table/m-p/635091&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 06:42:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676536#M18587</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-02-05T06:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676880#M18616</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Sir , may I ask about add data to kv store .&amp;nbsp;&lt;BR /&gt;I have try example from&amp;nbsp;SA-devforall post entry as below&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;function postNewEntry() {
    var record = {
        _time: (new Date).getTime() / 1000,
        status: $("#status").val(),
        message: $("#message").val(),
        user: Splunk.util.getConfigValue("USERNAME")
    }
    $.ajax({
        url: '/en-US/splunkd/__raw/servicesNS/nobody/SA-devforall/storage/collections/data/example_test',
        type: 'POST',
        contentType: "application/json",
        async: false,
        data: JSON.stringify(record),
        success: function(returneddata) { newkey = returneddata }
    })
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;and modify it to mine&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;    function postNewEntry(unique_id, status) {
        var record = {
            _time: (new Date).getTime() / 1000,
            status: $("#status").val(),
            unique_id:  $("#unique_id").val(),
        }

        $.ajax({
            url: ' https://10.1.1.1:8089/servicesNS/nobody/test/storage/collections/data/man_data/',
            type: 'POST',
            contentType: "application/json",
            async: false,
            data: JSON.stringify(record),
            success: function(returneddata) { newkey = returneddata }
        })
    }&lt;/LI-CODE&gt;&lt;P&gt;always get , net::ERR_CERT_AUTHORITY_INVALID&lt;BR /&gt;&lt;BR /&gt;if I do it one linux curl , and get another error code by test another kv-store file&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@test-Splunk01 local]# curl -k -u admin:admin123 https://10.1.1.1:8089/serviceNS/nobody/test/storage/collections/data/splunk_man -H 'Content-Type: application/json' -d '{"status": "UnACK" , "unique_id" : "11305421231213"}'
&amp;lt;!doctype html&amp;gt;&amp;lt;html&amp;gt;&amp;lt;head&amp;gt;&amp;lt;meta http-equiv="content-type" content="text/html; charset=UTF-8"&amp;gt;&amp;lt;title&amp;gt;405 Method Not Allowed&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&amp;lt;body&amp;gt;&amp;lt;h1&amp;gt;Method Not Allowed&amp;lt;/h1&amp;gt;&amp;lt;p&amp;gt;Specified method is not allowed on this resource.&amp;lt;/p&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;what can I do now ...&lt;BR /&gt;btw ,&amp;nbsp; this is my transforms config ..&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[root@plunk01 local]# cat transforms.conf
[man_data]
fields_list = _key , unique_id , status

[splunk_man]
collection = splunk_man
external_type = kvstore
fields_list = _key, unique_id , status&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;thank u so much&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2024 21:24:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676880#M18616</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-07T21:24:26Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676951#M18618</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Updated Answer for this thread.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103733"&gt;@willtseng0217&lt;/a&gt;&amp;nbsp; Please try&amp;nbsp;&lt;/STRONG&gt;below full sample code below your requirement.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;collections.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[my_status_data]
enforceTypes = true
field.status = string
field.unique_id = string&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[my_status_data_lookup]
external_type = kvstore
collection = my_status_data
fields_list = _key, status, unique_id&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;XML&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;dashboard version="1.1" theme="dark" script="test.js"&amp;gt;
	&amp;lt;label&amp;gt;js for button on table cell&amp;lt;/label&amp;gt;
	&amp;lt;row&amp;gt;
		&amp;lt;panel&amp;gt;
			&amp;lt;table id="table1"&amp;gt;
				&amp;lt;search id="SearchA"&amp;gt;
					&amp;lt;query&amp;gt;| makeresults count=10 
| eval A=1
| accum A
| eval B=random()
| lookup my_status_data_lookup unique_id as A output status
| eval action= case(isnull(status),"Ack",status=="Ack","Unack", 1=1,"Ack") +"|"+ A
| eval status = if(isnull(status),"",status) +"|"+A
&amp;lt;/query&amp;gt;
					&amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
					&amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
					&amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
				&amp;lt;/search&amp;gt;
				&amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
				&amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
				&amp;lt;option name="drilldown"&amp;gt;none&amp;lt;/option&amp;gt;
				&amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
				&amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
			&amp;lt;/table&amp;gt;
		&amp;lt;/panel&amp;gt;
	&amp;lt;/row&amp;gt;
&amp;lt;/dashboard&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;test.js&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require([
    'underscore',
    'jquery',
    'splunkjs/mvc',
    'splunkjs/mvc/tableview',
    'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, TableView) {
    console.log("Hie 65100");
    var SearchA = mvc.Components.get("SearchA");
    let CustomCellRenderer = TableView.BaseCellRenderer.extend({
        canRender: function (cell) {
            // Enable this custom cell renderer for the confirm field
            return _(["action", "status"]).contains(cell.field);
        },
        render: function ($td, cell) {
            if (cell.field == "action") {
                const cell_value = cell.value.split("|")[0]
                let unique_id = cell.value.split("|")[1];
                let button_id = "action_btn_" + unique_id;
                let div_id = "status_div_" + unique_id;

                console.log(cell_value);

                let button = $('&amp;lt;button /&amp;gt;', {
                    value: cell_value,
                    id: button_id,
                    on: {
                        click: function () {
                            console.log(unique_id, button_id);
                            console.log(div_id);
                            let div_value = $('#' + div_id).html();
                            let new_status = "";
                            if (div_value == "Ack") {
                                $('#' + div_id).html("Unack");
                                $('#' + button_id).html("Ack");
                                new_status = "Unack"

                            } else {
                                $('#' + div_id).html("Ack");
                                $('#' + button_id).html("Unack");
                                new_status = "Ack"
                            }
                            update_collection_data(unique_id, new_status);
                        }
                    }
                }).addClass("extend_expiry btn-sm btn btn-primary").html(cell_value);
                $td.html(button)
            }
            if (cell.field == "status") {
                console.log(cell.value);
                const cell_value = cell.value.split("|")[0]
                const cell_id = cell.value.split("|")[1]
                console.log(cell_value);
                console.log(cell_id);
                let div_id = "status_div_" + cell_id;
                let html = `&amp;lt;div id="` + div_id + `"&amp;gt;` + cell_value + `&amp;lt;/div&amp;gt;`
                $td.html(html)
            }
        }
    });

    function update_collection_data(unique_id, status) {
        var record = {
            status: status,
            unique_id: unique_id,
            _key: unique_id
        }
        let collection = "my_status_data";
        $.ajax({
            url: '/en-US/splunkd/__raw/servicesNS/nobody/search/storage/collections/data/' + collection + '/' + unique_id,
            type: "POST",
            async: true,
            contentType: "application/json",
            data: JSON.stringify(record),
            success: function(returneddata) {
                console.log("Updated!", returneddata)
            },
            error: function(xhr, textStatus, error) {
                console.error("Error Updating!", xhr, textStatus, error);
                $.ajax({
                    url: '/en-US/splunkd/__raw/servicesNS/nobody/search/storage/collections/data/' + collection,
                    type: "POST",
                    async: true,
                    contentType: "application/json",
                    data: JSON.stringify(record),
                    success: function(returneddata) {
                        console.log("Added!", returneddata)
                    },
                    error: function(xhr, textStatus, error) {
                        console.error("Error Adding!", xhr, textStatus, error);
                    }
                });
            }
        });


    }
    let sh = mvc.Components.get("table1");
    if (typeof (sh) != "undefined") {
        sh.getVisualization(function (tableView) {
            // Add custom cell renderer and force re-render
            tableView.table.addCellRenderer(new CustomCellRenderer());
            tableView.table.render();
        });
    }
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this will help you.&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;If any of my replies help you to solve the problem Or gain knowledge, an upvote would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 09:19:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676951#M18618</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2024-02-08T09:19:56Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676989#M18622</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;it's works !!&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;&lt;SPAN&gt;deeply&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;appreciate&lt;/STRONG&gt;&lt;SPAN&gt;d your kindly support ...&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2024 18:09:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/676989#M18622</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-08T18:09:40Z</dc:date>
    </item>
    <item>
      <title>Re: js for button on table cell</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/679078#M18771</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Sir,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;May I ask for a help , If I want to limit user to use this method&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Could u please teach me how tow set the&amp;nbsp;&lt;SPAN&gt;least privilege&lt;BR /&gt;&lt;BR /&gt;I just know that config power user and edit-kvstore , but I don't want give the normal user to much&amp;nbsp;&lt;BR /&gt;thanks for help&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="willtseng0217_0-1709170733565.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/29554i21A8E7002160B386/image-size/medium?v=v2&amp;amp;px=400" role="button" title="willtseng0217_0-1709170733565.png" alt="willtseng0217_0-1709170733565.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Feb 2024 01:39:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/js-for-button-on-table-cell/m-p/679078#M18771</guid>
      <dc:creator>willtseng0217</dc:creator>
      <dc:date>2024-02-29T01:39:10Z</dc:date>
    </item>
  </channel>
</rss>

