I'm trying to follow the instructions here, but making the app my own a bit. I have converted my XML dashboard to HTML and am working on editing the JavaScript to make it do something. I have a button that when pressed needs to access the results of search1 (which is the manager for a TableElement) and grab the values in one of the rows. I have this so far:
$("#closeIssue").click(function() {
// Get the value of the key ID field
var tokens = mvc.Components.get("default");
var form_keyid = tokens.get("form.keyid");
var mySearch = splunkjs.mvc.Components.getInstance("search1");
console.log( "mysearch:", mySearch );
var myResults = mySearch.data("results", {count:0});
console.log( "myresults:", myResults );
var myrd = myResults.data();
console.log( "myrd:", myrd );
var rows = myrd.rows;
console.log( "rows:", rows );
return false;
}
The problem is that the "rows" variable is undefined. Looking at the Google Chrome JavaScript console, myResults has data. Looking in the object in _data are the rows I expect to be there. However, when I call `myResults.data()`, it returns undefined. Any thoughts on how to get the data?
Thanks in advance
↧