The DataTemplate view is a generic view that provides developers with the ability to display an underscore.js template and fill it out with the results of an associated search manager.
Name | Default value | Description |
id | Required. The unique ID for this control. | |
data | "preview" | The type of data to retrieve from the search results ( results | preview | events | summary | timeline ). |
managerid | null | The ID of the search manager to bind this view to. |
messages | false | Indicates whether to display messages. |
template | "" | The template to render. You can specify the Underscore template inline as a string, or programmatically. For examples, see the Splunk Web Framework Toolkit. |
templateName | "" | The CSS ID of the template to render. This ID should refer to an ID that is within a <script> tag. For examples, see the Splunk Web Framework Toolkit. |
Name | Description |
render | Draws the view to the screen. Called only when you create the view manually in JavaScript. |
{% dataview id="mydataview" managerid="example-search" template="<%= results[0].count %>" %}
<script> var deps = [ "splunkjs/ready!", "splunkjs/mvc/dataview" ]; require(deps, function(mvc) { var DataView = require("splunkjs/mvc/dataview"); // Instantiate components new DataView({ id: "example-data", managerid: "example-search", template: "<%= results[0].count %>", el: $("#mydataview") }).render(); }); </script>