Good day, I am currently using Splunk 6 Web Framework for my app development and I noticed something with the drilldown properties if set to false it doesn't work, it will still drilldown when the user initiates to click. This was tested with maps and tables since these are my two dashboard panels.
Based on the documentation.
Properties
drilldown
| true
| Indicates whether to enable a drilldown action when this view is clicked.
drilldownRedirect
| true
| Indicates whether to redirect to a search page when clicked. When true, a refined search corresponding to the point that was clicked is displayed in the search app. When false, you must create a click event handler to define a drilldown action. You can also use the preventDefault method in the click event handler to bypass the default redirect to search.
I tried both and set the properties to false but still my view continue to drilldown. I dont know how to use the preventDefault, I tried adding preventDefault=true but still proceed to drilldowns. I'm using the Django bindings btw.
Hope to here from you guys.
Thanks
It's a bit hard to answer without seeing what code you're trying, but here is a sample that shows the various ways to disable drilldown on a table:
<script>
var deps = [
"splunkjs/mvc",
"splunkjs/mvc/tableview",
"splunkjs/mvc/searchmanager"
];
require(deps, function() {
var TableView = require("splunkjs/mvc/tableview");
var SearchManager = require("splunkjs/mvc/searchmanager");
var table1 = new TableView({
id: "table1",
managerid: "search1",
el: $("#table1")
}).render();
var table2 = new TableView({
id: "table2",
drilldownRedirect: false,
managerid: "search1",
el: $("#table2")
}).render();
table2.on('click', function(e) {
alert('CLICKED!');
});
var table3 = new TableView({
id: "table3",
drilldown: "none",
managerid: "search1",
el: $("#table3")
}).render();
table3.on('click', function(e) {
alert('NEVER HAPPENS!');
});
var table4 = new TableView({
id: "table4",
managerid: "search1",
el: $("#table4")
}).render();
table4.on('click', function(e) {
e.preventDefault();
alert('DRILLDOWN DISABLED!');
});
new SearchManager({
id: "search1",
earliest_time: "-24h@h",
latest_time: "now",
search: "index=_internal | stats count by sourcetype"
});
});
</script>
The idea is that you can disable various things:
drilldown
controls whether click events are enabled at all.drilldownRedirect
allows you to disable the default redirect behavior but maintain the click events.preventDefault()
allows you to dynamically disable the default redirect behavior in the cases that you want.Hopefully this helps.
The drilldown property takes different values depending on which view you are working with. Here's the reference for the table view--note that drilldown can be set to row|cell|none: http://docs.splunk.com/DocumentationStatic/WebFramework/1.0/compref_table.html.
Here's a topic that gives examples of how to set these properties for each type of view:
http://dev.splunk.com/view/SP-CAAAEME.
Hi @apruneda_splunk, I have viewed the docs and yes I have forgot that the drilldown properties for Table views. Thanks for your reply
It's a bit hard to answer without seeing what code you're trying, but here is a sample that shows the various ways to disable drilldown on a table:
<script>
var deps = [
"splunkjs/mvc",
"splunkjs/mvc/tableview",
"splunkjs/mvc/searchmanager"
];
require(deps, function() {
var TableView = require("splunkjs/mvc/tableview");
var SearchManager = require("splunkjs/mvc/searchmanager");
var table1 = new TableView({
id: "table1",
managerid: "search1",
el: $("#table1")
}).render();
var table2 = new TableView({
id: "table2",
drilldownRedirect: false,
managerid: "search1",
el: $("#table2")
}).render();
table2.on('click', function(e) {
alert('CLICKED!');
});
var table3 = new TableView({
id: "table3",
drilldown: "none",
managerid: "search1",
el: $("#table3")
}).render();
table3.on('click', function(e) {
alert('NEVER HAPPENS!');
});
var table4 = new TableView({
id: "table4",
managerid: "search1",
el: $("#table4")
}).render();
table4.on('click', function(e) {
e.preventDefault();
alert('DRILLDOWN DISABLED!');
});
new SearchManager({
id: "search1",
earliest_time: "-24h@h",
latest_time: "now",
search: "index=_internal | stats count by sourcetype"
});
});
</script>
The idea is that you can disable various things:
drilldown
controls whether click events are enabled at all.drilldownRedirect
allows you to disable the default redirect behavior but maintain the click events.preventDefault()
allows you to dynamically disable the default redirect behavior in the cases that you want.Hopefully this helps.
Yes, if you'd like to do some custom logic on drilldown, you need to register a JS custom event handler. Feel free to post another Answers question regarding this if you want some examples.
Hi @ineeman I have managed to disable drilldowns on my map view. The thing is I need to visit another app view for my page to take effect of the drilldown. Instead of just refreshing my page. I see you use javascript on making your views, I'm not knowledgeable about it but I guess it will help others. Thanks again for your reply
Panel Type: Map - false to disable drilldown
Panel Type: Table - none to disable drilldown