Hello!
Here is my xml:
<form script="next-prev-btn.js">
<label>Test Next-Prev btn onclick</label>
...
...
<row>
<panel>
<title>Title1</title>
...
...
<html>
<div>
<button id="pr_button" class="btn btn-primary" onclick="prevpage()">Назад</button>
<button id="nxt_button" class="btn btn-primary" style="float: right;">Далее</button>
</div>
</html>
</panel>
</row>
</form>
and this is my js:
require([
"jquery",
"splunkjs/mvc/searchmanager",
"splunkjs/mvc/simplexml/ready!"
], function(
$,
SearchManager
) {
var mysearch = new SearchManager({
id: "mysearch",
autostart: "false",
search: "| gentimes start=-1| eval time=\"06.06.2017 10:00\" | eval field4=\"$field4$\" | eval field5=\"$field5$\" | outputlookup $field1$$field2$$field3$.csv"
}, {tokens: true, tokenNamespace: "submitted"});
$("#nxt_button").on("click", function (){
mysearch.startSearch();
window.open ('localhost:8000/en-US/app/testform/test-form-next-button2','_self',false);
});
});
It works good when I use Splunk 6.3.3 but it does not work on Splunk 6.6.2
I'm get an error:
Uncaught TypeError: startSearch() is not a function
I am facing the same issue using the function startSearch() for the version 6.6.2. Do someone know why this issue happens?,I am facing the same issue with the function "startSearch()" for the version 6.6.2. Do someone know why it happens?
@oleg_kirichenko, are you seeing the above error in JavaScript Console log?
I tried the following JavaScript Code. While it did not error out. window.open just seem to refresh the page. I am not sure how search results can be shown in the new window (based on your example seems like you are opening a separate dashboard in the same window)
require([
"jquery",
"splunkjs/mvc/utils",
"splunkjs/ready!",
"splunkjs/mvc/simplexml/ready!",
"splunkjs/mvc/searchmanager",
], function(
$,
utils,
SearchManager){
var SearchManager = require("splunkjs/mvc/searchmanager");
var search1 = new SearchManager({
"id": "search1",
"search": "| makeresults | eval value=\"Search Result\"",
"earliest_time": "$earliest$",
"cancelOnUnload": true,
"status_buckets": 0,
"sample_ratio": null,
"latest_time": "$latest$",
"app": utils.getCurrentApp(),
"auto_cancel": 90,
"preview": true,
"tokenDependencies": {
},
"runWhenTimeIsUndefined": false
}, {tokens: true, tokenNamespace: "submitted"});
$("#nxt_button").on("click", function (){
search1.startSearch();
window.open ("http://localhost:8000/en-US/app/<MyApp>/<MyDashboard>","_self",false);
});
});
What do you want to achieve through startSearch()? Can a token be directly passed from main dashboard to the next one while keeping the browser window same?