Splunk Dev

How to redirect another template in Django (SplunkJS) ?

ryuch2002
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
1 Solution

vganjare
Builder

Try following code:

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

APP_NAME : 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

vganjare
Builder

Try following code:

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

APP_NAME : the given app name within which the template is residing.
TEMPLATE_NAME: The template name given in urls.py.

Thanks!!

0 Karma

ryuch2002
Explorer

Thank you for answer!!! i solved it.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...