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. |
settings | The properties of the view. See the methods below to get and set values. | |
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. |
settings.get( property ) | Returns the value of property for the current component. |
settings.set( property, value ) | Sets the value of property to the specified value for the current component. |
require([ "splunkjs/mvc/datatemplateview", "splunkjs/mvc/simplexml/ready!" ], function(DataTemplateView) { // Instantiate components new DataTemplateView({ id: "example-data", managerid: "example-search", template: "<%= results[0].count %>", el: $("#mydatatemplateview") }).render(); });