Developing for Splunk Enterprise
Highlighted

How to redirect another template in Django (SplunkJS) ?

Explorer

splunk version : 6.2.2

some code :
-- content area ---

<div class="panel-body" >
 {% chart id="chart_avgResponseTime" managerid="avgResponseTime" type="line" drilldown="all" drilldownRedirect=false %}
</div>

--script code --

<script>
        var deps = [
            "splunkjs/ready!"
        ];
        require(deps, function(mvc) {
            var chart_avgResponseTime = splunkjs.mvc.Components.getInstance("chart_avgResponseTime");
            chart_avgResponseTime.on("click:chart", function(e) {

            ******* i want to redirect another template(or page) ******            

});         
</script>
0 Karma
Highlighted

Re: How to redirect another template in Django (SplunkJS) ?

Builder

Try following code:

 e.preventDefault();
window.location.href="{% url '<APP_NAME>:<TEMPLATE_NAME>' %}?param1=value1&param2=Value2

APPNAME : the given app name within which the template is residing.
TEMPLATE
NAME: The template name given in urls.py.

Thanks!!

View solution in original post

0 Karma
Highlighted

Re: How to redirect another template in Django (SplunkJS) ?

Explorer

Thank you for answer!!! i solved it.

0 Karma