Hi!
I have a dashboard that has search input fields that allow to run a search and the results are displayed on the table.
I want to create a custom button to act on the data from the search. I don't want to repeat the search using tokens and searchmanager.
Is it possible to load the full results from the table on javascript in the case of a multi page table like this :
I know it's possible to download a .csv file using the SID from the search but I want to know if there is other way to do it.
I can extract the data from the table page that's currently rendered on the dashboard.
Thank you in advance.
@splunkhmcv - You can do it with the search id.
Assign id to search in XML, like
<table>
<search id="my_search">
<query>....
And you can read the same results in the JS like:
// Imports
require([
'splunkjs/mvc',
...
// read the same search results
let mySearchManager = mvc.Components.get("my_search");
let myResults = mySearchManager.data("results");
myResults.on("data", function () {
resultArray = myResults.data().rows;
$.each(resultArray, function (index, value) {
console.log(value);
});
});
I hope this helps!!!