ok so i have a drilldown so in this table there is a field solved which have default value 0 which means this particular severity is not solved . Now i want a button instead of 0 .like this ...
See more...
ok so i have a drilldown so in this table there is a field solved which have default value 0 which means this particular severity is not solved . Now i want a button instead of 0 .like this now whenever a severity is being solved then when we click on this button it should change like this and this specific result its value (solve field ) should be changed to 1. this is JS i am using but it is not working. plus ye script thi jo mai use kar raha hun require([ 'splunkjs/mvc/tableview', 'splunkjs/mvc/searchmanager', 'splunkjs/mvc', 'underscore', 'splunkjs/mvc/simplexml/ready!' ], function( TableView, SearchManager, mvc, _ ) { var CustomLinkRenderer = TableView.BaseCellRenderer.extend({ canRender: function(cell) { return cell.field === 'solved'; }, render: function($td, cell) { var solved = cell.value; var rowKey = cell.data.row.rowKey; var icon = $('<a>') .attr("href", "#") .attr("title", "Mark as Solved") .css({ "cursor": "pointer", "text-align": "center", "display": "inline-block", "width": "100%" }); icon.html('<i class="icon ' + (solved === "1" ? 'icon-check-circle' : 'icon-minus-circle') + '"></i>'); icon.on("click", function(e) { e.preventDefault(); var $icon = $(this).find('i'); // Only run update if not already solved if (solved === "1") { return; // Already marked as solved } $icon.removeClass("icon-minus-circle").addClass("icon-gear"); var updateSearch = ` | inputlookup sbc_major.csv | eval rowKey=tostring(rowKey) | eval match=if(rowKey="${rowKey}", "1", "0") | eval solved=if(match="1", "1", solved) | fields - match | outputlookup sbc_major.csv `; var updateManager = new SearchManager({ id: "update-solved-" + _.uniqueId(), preview: false, cache: false, search: updateSearch }); updateManager.on("search:done", function() { $icon.removeClass("icon-gear").addClass("icon-check-circle"); }); }); $td.empty().append(icon); } }); var tableElement = mvc.Components.getInstance("sbc_alarm_table"); tableElement.getVisualization(function(tableView) { tableView.table.addCellRenderer(new CustomLinkRenderer()); tableView.table.render(); }); });