TableView

The Table view

Description

The Table view displays a table of search results.

Library path

Simple XML wrapper

Properties

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 ).
dataOverlayMode"none"The type of overlay to display
heatmap | highlow | none ).
displayRowNumbersfalseIndicates whether to display row numbers.
drilldown"row"The type of drilldown action
row | cell | none ).
drilldownRedirecttrueIndicates whether to redirect to a search page when clicked. When true, a refined search corresponding to the point that was clicked is displayed in the search app. When false, you must create a click event handler to define a drilldown action. You can also use the preventDefault method in the click event handler to bypass the default redirect to search.
fieldsnullThe fields to display in the table. Specify a comma-separated string or an array of strings.
formatnullThe properties for a sparkline, in the format:
format: {
    "sparkline_fieldname": [
        {
            "type": "sparkline",

            // Sparkline options
            "options": 
            {
                "property-1": "value-1",
                ...
                "property-n": "value-n"
            }
        }
    ]
}
where sparkline_fieldname and type are required. For more, see How to customize table cells and format sparklines.
manageridnullThe ID of the search manager to bind this view to.
pagerPosition"bottom"The position on the page where the page is displayed ( top | bottom ).
pageSize10The number of results per page.
settingsThe properties of the view. See the methods below to get and set values.
showPagertrueIndicates whether to display the table pagination control.
wrapfalseIndicates whether to wrap text in the results table.

Methods

Name

Description

addRowExpansionRenderer(renderer)Adds a row renderer to the table, where renderer is an instance of your custom row renderer.
addCellRenderer(renderer)Adds a cell renderer to the table, where renderer is an instance of your custom cell renderer.
collapseRowCollapses the currently-expanded row.
expandRow(index)Expands the row specified by index, and collapses the currently-expanded row.
getCellRenderersGets an array of the cell renderers that have been added to the table.
getRowExpansionRenderersGets an array of the row renderers that have been added to the table.
removeRowExpansionRenderer(renderer)Removes a row renderer from the table, where renderer is an instance of your custom row renderer.
removeCellRenderer(renderer)Removes a cell renderer from the table, where renderer is an instance of your custom cell renderer.
renderDraws 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( propertyvalue )Sets the value of property to the specified value for the current component.

Events

Name

Description

click:cellFired when a cell is clicked.
click:rowFired when a row is clicked.

Example

require([
    "splunkjs/mvc/tableview",
    "splunkjs/mvc/simplexml/ready!"
], function(TableView) {

    // Instantiate components
    new TableView({
        id: "example-table",
        managerid: "example-search",
        pageSize: "5",
        el: $("#mytableview")
    }).render();

});