How to customize drilldown actions using Django Bindings

Django Bindings has been deprecated. For more, see the Deprecation Notice.

The Chart, Table, EventsViewer, and SplunkMap views provide drilldown actions when the user clicks the view. You can enable or disable drilldown behavior using Django tags, but you can only customize the drilldown action in JavaScript.

Each view supports drilldown differently:

  • Chart view: set the drilldown property to "all" to enable drilldown, or "none" to disable it.
  • Table view: set the drilldown property to "row" to enable drilldown for the entire row, "cell" for an individual cell, or "none" to disable it.
  • SplunkMap view: set the drilldown property to true or false to enable or disable drilldown.
  • EventsViewer view: This view has a drilldown property that corresponds to event format types (list, table, or raw), and these properties cannot be set using Django tags. By default, the format type is "list" and the list.drilldown property is set to "full" to enable drilldown for the full event. To change this property, you'll need to use JavaScript. For more, see How to customize drilldown actions using SplunkJS Stack.

For more about the properties of each view, see the Splunk Web Framework Component Reference.

Example

The following example shows how to set drilldown properties using Django tags.

Note  For the SplunkMap view, this example uses search results from a sample earthquakes lookup table, and includes lat and lon fields in the search query. To try it for yourself, download earthquakes.csv to a /lookups directory under $SPLUNK_HOME/etc/apps/your_app_name.

{% extends "splunkdj:base_with_app_bar.html" %}

{% load splunkmvc %}

{% block content %}
    <h4>Disable drilldown redirect (the events look clickable but nothing happens):</h4>
    {% eventsviewer 
        id="example-viewer" managerid="main-search" softWrap=True
        drilldownRedirect=False %}

    <h4>Disable drilldown:</h4>
    {% chart id="example-chart" managerid="subsearch1" type="bar"
        drilldown="none" %}

    <h4>Enable drilldown for table cells (the default is for rows):</h4>
    {% table id="example-table" managerid="subsearch2" wrap=True
        drilldown="cell" %}

    <h4>Enable drilldown and enable redirect (no change from default behavior):</h4>
    {% splunkmap id="example-map" managerid="map-search" 
        drilldown=True 
        drilldownRedirect=True %}
{% endblock content%}

{% block managers %}
    {% searchmanager id="main-search"  
        search="index=_internal | head 100 | fields *" %} 
    {% postprocessmanager id="subsearch1" managerid="main-search" 
        search=" | stats count by sourcetype" %} 
    {% postprocessmanager id="subsearch2" managerid="main-search" 
        search=" | fields sourcetype, source, host" %} 
    {% searchmanager id="map-search" 
        search="| inputlookup earthquakes.csv | rename Lat as lat Lon as lon | geostats count" %} 
{% endblock managers %}