Interface PivotTable

All Superinterfaces:
Component, Component.BelongToFrame, Component.Editable, Component.HasCaption, Component.HasDescription
All Known Implementing Classes:
PivotTableImpl

@StudioComponent(caption="PivotTable", category="Components", xmlElement="pivotTable", xmlns="http://jmix.io/schema/ui/pivot-table", xmlnsAlias="pivot", icon="io/jmix/pivottable/icon/table.svg", canvasIcon="io/jmix/pivottable/icon/table.svg", canvasIconSize=LARGE, documentationURL="https://docs.jmix.io/jmix/%VERSION%/pivot-table/index.html") public interface PivotTable extends Component, Component.BelongToFrame, Component.Editable, Component.HasCaption
  • Field Details

  • Method Details

    • repaint

      void repaint()
      Resend all items and properties to client and repaint pivot table. Use this method if you change some property of already displayed pivot table.
    • getProperties

      Map<String,String> getProperties()
      Returns:
      the map whose keys are DataItem property names to use as pivot table data and values they localized names
    • setProperties

      @StudioElementsGroup(xmlElement="properties", caption="Properties", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.Property") void setProperties(Map<String,String> properties)
      Sets the map whose keys are DataItem property names to use as pivot table data and values they localized names.
      Parameters:
      properties - a map of properties names with localized values
    • addProperties

      void addProperties(Map<String,String> properties)
      Adds a map whose keys are DataItem property names to use as pivot table data and values they localized names.
      Parameters:
      properties - a map of properties names with localized values
    • addProperty

      void addProperty(String property, String value)
      Add a property with its localized value
      Parameters:
      property - property name
      value - localized value
    • getRows

      List<String> getRows()
      Returns:
      the list of properties names to use as rows.
    • setRows

      @StudioElementsGroup(xmlElement="rows", caption="Rows", icon="io/jmix/pivottable/icon/row.svg", elementClass="io.jmix.pivottable.model.meta.Row") void setRows(List<String> rows)
      Sets the list of properties names to use as rows.
      Parameters:
      rows - a list of properties names
    • addRows

      void addRows(String... rows)
      Adds an array of properties names to use as rows.
      Parameters:
      rows - an array of properties names
    • getColumns

      List<String> getColumns()
      Returns:
      the list of property names to use as columns.
    • setColumns

      @StudioElementsGroup(xmlElement="columns", caption="Columns", icon="io/jmix/pivottable/icon/columns.svg", elementClass="io.jmix.pivottable.model.meta.Column") void setColumns(List<String> cols)
      Sets the list of property names to use as columns.
      Parameters:
      cols - a list of properties names
    • addColumns

      void addColumns(String... cols)
      Adds an array of property names to use as columns.
      Parameters:
      cols - an array of properties names
    • getAggregation

      Aggregation getAggregation()
      Returns:
      the aggregation object which defines how pivot table will aggregate results per cell
    • setAggregation

      void setAggregation(Aggregation aggregation)
      Sets the aggregation object.

      Applies only when editable=false.

      Parameters:
      aggregation - an aggregation object
    • getRenderer

      Renderer getRenderer()
      Returns:
      the renderer object which generates output from pivot data structure
    • setRenderer

      @StudioProperty(type=ENUMERATION) void setRenderer(Renderer renderer)
      Sets the renderer object.

      Applies only when editable=false.

      Parameters:
      renderer - a renderer object
    • getAggregationProperties

      List<String> getAggregationProperties()
      Returns:
      the list of properties names to prepopulate in vals area (gets passed to aggregator generating function)
    • setAggregationProperties

      @StudioElementsGroup(xmlElement="aggregationProperties", caption="Aggregation Properties", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.NamedProperty") void setAggregationProperties(List<String> aggregationProperties)
      Sets the list of properties names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when editable=true.

      Parameters:
      aggregationProperties - a list of properties names
    • addAggregationProperties

      void addAggregationProperties(String... aggregationProperties)
      Adds an array of properties names to prepopulate in vals area (gets passed to aggregator generating function).

      Applies only when editable=true.

      Parameters:
      aggregationProperties - an array of properties names
    • getAggregations

      Aggregations getAggregations()
      Returns:
      the aggregations object which defines the collection of aggregations to use in pivot table and additional settings for them.
    • setAggregations

      void setAggregations(Aggregations aggregations)
      Sets the aggregations object which defines the collection of aggregations to use in pivot table and additional settings for them.

      Applies only when editable=true.

      Parameters:
      aggregations - an aggregations object
    • getRenderers

      Renderers getRenderers()
      Returns:
      the renderers object which defines the collection of renderers to use in pivot table and additional settings for them.
    • setRenderers

      @StudioElementsGroup(caption="Renderers", xmlElement="renderers", icon="io/jmix/pivottable/icon/component.svg", elementClass="io.jmix.pivottable.model.meta.Renderer") void setRenderers(Renderers renderers)
      Sets the renderers object which defines the collection of renderers to use in pivot table and additional settings for them.

      Applies only when editable=true.

      Parameters:
      renderers - a renderers object
    • getHiddenProperties

      List<String> getHiddenProperties()
      Returns:
      the list of properties names to omit from the UI
    • setHiddenProperties

      @StudioElementsGroup(caption="Hidden Properties", xmlElement="hiddenProperties", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.NamedProperty") void setHiddenProperties(List<String> hiddenProperties)
      Sets the list of properties names to omit from the UI.

      Applies only when editable=true.

      Parameters:
      hiddenProperties - a list of properties names
    • addHiddenProperties

      void addHiddenProperties(String... hiddenProperties)
      Adds an array of properties names to omit from the UI.

      Applies only when editable=true.

      Parameters:
      hiddenProperties - an array of properties names
    • getHiddenFromAggregations

      List<String> getHiddenFromAggregations()
      Returns:
      list of properties names to omit from the aggregation arguments dropdowns
    • setHiddenFromAggregations

      @StudioElementsGroup(caption="Hidden from Aggregations", xmlElement="hiddenFromAggregations", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.NamedProperty") void setHiddenFromAggregations(List<String> hiddenFromAggregations)
      Sets the list of properties names to omit from the aggregation arguments dropdowns.

      Applies only when editable=true.

      Parameters:
      hiddenFromAggregations - a list of properties names
    • addHiddenFromAggregations

      void addHiddenFromAggregations(String... hiddenFromAggregations)
      Adds an array of properties names to omit from the aggregation arguments dropdowns.

      Applies only when editable=true.

      Parameters:
      hiddenFromAggregations - an array of properties names
    • getHiddenFromDragDrop

      List<String> getHiddenFromDragDrop()
      Returns:
      list of properties names to omit from the drag'n'drop portion of the UI
    • setHiddenFromDragDrop

      @StudioElementsGroup(caption="Hidden from Drag&Drop", xmlElement="hiddenFromDragDrop", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.NamedProperty") void setHiddenFromDragDrop(List<String> hiddenFromDragDrop)
      Sets the list of properties names to omit from the drag'n'drop portion of the UI.

      Applies only when editable=true.

      Parameters:
      hiddenFromDragDrop - a list of properties names
    • addHiddenFromDragDrop

      void addHiddenFromDragDrop(String... hiddenFromDragDrop)
      Adds an array of properties names to omit from the drag'n'drop portion of the UI.

      Applies only when editable=true.

      Parameters:
      hiddenFromDragDrop - an array of properties names
    • getColumnOrder

      ColumnOrder getColumnOrder()
      Returns:
      the order in which column data is provided to the renderer
    • setColumnOrder

      @StudioProperty(type=ENUMERATION) void setColumnOrder(ColumnOrder columnOrder)
      Set the order in which column data is provided to the renderer.

      Ordering by value orders by column total.

      Parameters:
      columnOrder - the order in which column data is provided to the renderer
    • getRowOrder

      RowOrder getRowOrder()
      Returns:
      the order in which row data is provided to the renderer
    • setRowOrder

      @StudioProperty(type=ENUMERATION) void setRowOrder(RowOrder rowOrder)
      Sets the order in which row data is provided to the renderer.

      Ordering by value orders by row total.

      Parameters:
      rowOrder - the order in which row data is provided to the renderer
    • getMenuLimit

      Integer getMenuLimit()
      Returns:
      maximum number of values to list in the double-click menu
    • setMenuLimit

      @StudioProperty void setMenuLimit(Integer menuLimit)
      Sets maximum number of values to list in the double-click menu.

      Applies only when editable=true.

      Parameters:
      menuLimit - maximum number of values to list in the double-click menu
    • getAutoSortUnusedProperties

      Boolean getAutoSortUnusedProperties()
      Returns:
      true if unused properties are kept sorted in the UI and false otherwise
    • setAutoSortUnusedProperties

      @StudioProperty void setAutoSortUnusedProperties(Boolean autoSortUnusedProperties)
      Controls whether or not unused properties are kept sorted in the UI.

      Applies only when editable=true.

      Parameters:
      autoSortUnusedProperties - true if unused properties are kept sorted in the UI and false otherwise
    • getUnusedPropertiesVertical

      UnusedPropertiesVertical getUnusedPropertiesVertical()
      Returns:
      true if unused attributes are shown always vertical, false if always horizontal. If set to a number (as is the default) then if the properties' names' combined length in characters exceeds the number then the properties will be shown vertically.
    • setUnusedPropertiesVertical

      @StudioProperty(type=STRING) void setUnusedPropertiesVertical(UnusedPropertiesVertical unusedPropertiesVertical)
      Controls whether or not unused properties are shown vertically instead of the default which is horizontally. true means always vertical, false means always horizontal. If set to a number (as is the default) then if the properties' names' combined length in characters exceeds the number then the properties will be shown vertically.

      Applies only when editable=true.

      Parameters:
      unusedPropertiesVertical - properties
    • getDataProvider

      DataProvider getDataProvider()
      Returns:
      data provider for PivotTable. Contains items which will be shown on PivotTable.
    • setDataProvider

      void setDataProvider(DataProvider dataProvider)
      Sets data provider for PivotTable. Contains items which will be shown on PivotTable.
      Parameters:
      dataProvider - a data provider
    • addData

      void addData(DataItem... dataItems)
      Adds a data item to data provider.
      Parameters:
      dataItems - a data item to add
    • getFilterFunction

      JsFunction getFilterFunction()
      Returns:
      the JsFunction which defines a javascript code called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
    • setFilterFunction

      @StudioProperty(type=JS_FUNCTION) void setFilterFunction(JsFunction filter)
      Sets the JsFunction which defines a javascript code called on each record, returns false if the record is to be excluded from the input before rendering or true otherwise
      Parameters:
      filter - a JsFunction to use as a filter
    • getSortersFunction

      JsFunction getSortersFunction()
      Returns:
      the JsFunction which defines a javascript code called with an property name and can return a function which can be used as an argument to Array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names
    • setSortersFunction

      @StudioProperty(type=JS_FUNCTION) void setSortersFunction(JsFunction sorters)
      Sets the JsFunction which defines a javascript code called with an property name and can return a function which can be used as an argument to Array.sort for output purposes. If no function is returned, the default sorting mechanism is a built-in "natural sort" implementation. Useful for sorting attributes like month names
      Parameters:
      sorters - a JsFunction to use as a sorters
    • getRendererOptions

      RendererOptions getRendererOptions()
      Returns:
      the object passed through to renderer as options
    • setRendererOptions

      void setRendererOptions(RendererOptions rendererOptions)
      Sets object passed through to renderer as options.
      Parameters:
      rendererOptions - object defines renderer options
    • getInclusions

      Map<String,List<String>> getInclusions()
      Returns:
      map whose keys are properties names and values are lists of properties values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click
    • setInclusions

      @StudioElementsGroup(xmlElement="inclusions", caption="Inclusions", icon="io/jmix/pivottable/icon/component.svg", elementClass="io.jmix.pivottable.model.meta.NamedPropertyWithValues") void setInclusions(Map<String,List<String>> inclusions)
      Sets map whose keys are properties names and values are lists of properties values which denote records to include in rendering; used to prepopulate the filter menus that appear on double-click (overrides exclusions).

      Applies only when editable=true.

      Parameters:
      inclusions - map with properties and values included in rendering
      See Also:
    • setInclusions

      void setInclusions(String property, List<String> inclusions)
      Sets the value of inclusions map.
      Parameters:
      property - property name
      inclusions - a list of properties values
      See Also:
    • addInclusions

      void addInclusions(String property, String... inclusions)
      Adds a values to given key of inclusions map.
      Parameters:
      property - a property name
      inclusions - an array of properties values
      See Also:
    • getExclusions

      Map<String,List<String>> getExclusions()
      Returns:
      map whose keys are properties names and values are lists of properties values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click
    • setExclusions

      @StudioElementsGroup(xmlElement="exclusions", caption="Exclusions", icon="io/jmix/pivottable/icon/component.svg", elementClass="io.jmix.pivottable.model.meta.NamedPropertyWithValues") void setExclusions(Map<String,List<String>> exclusions)
      Sets map whose keys are properties names and values are lists of properties values which denote records to exclude from rendering; used to prepopulate the filter menus that appear on double-click.

      Applies only when editable=true.

      Parameters:
      exclusions - map with properties and values excluded from rendering
      See Also:
    • setExclusions

      void setExclusions(String property, List<String> exclusions)
      Sets the value of exclusions map.
      Parameters:
      property - property name
      exclusions - a list of properties values
      See Also:
    • addExclusions

      void addExclusions(String property, String... exclusions)
      Adds a values to given key of exclusions map.
      Parameters:
      property - a property name
      exclusions - an array of properties values
      See Also:
    • getDerivedProperties

      DerivedProperties getDerivedProperties()
      Returns:
      object to define derived properties
    • setDerivedProperties

      @StudioElementsGroup(caption="Derived Properties", xmlElement="derivedProperties", icon="io/jmix/pivottable/icon/properties.svg", elementClass="io.jmix.pivottable.model.meta.DerivedProperty") void setDerivedProperties(DerivedProperties derivedProperties)
      Sets object to define derived properties.
      Parameters:
      derivedProperties - object to define derived properties
    • setNativeJson

      void setNativeJson(String json)
      Set additional JSON configuration as a string. This JSON can override configuration loaded from XML and from Component API.
      Parameters:
      json - additional JSON configuration
    • getNativeJson

      String getNativeJson()
      Returns:
      additional JSON configuration as a string.
    • getEmptyDataMessage

      String getEmptyDataMessage()
      Returns:
      the message that will be displayed in case of empty data
    • setShowUI

      @StudioProperty void setShowUI(Boolean showUI)
      Hides or shows UI elements in the editable pivot table. true by default.
      Applies only when editable=true.
      Parameters:
      showUI - true if UI elements should be shown and false otherwise
    • isShowUI

      Boolean isShowUI()
      Returns:
      true if pivotUI() should be shown and false otherwise
    • setShowRowTotals

      @StudioProperty void setShowRowTotals(Boolean showRowTotals)
      Set false if row totals shouldn't be shown and true otherwise. Works only for table renderers. true by default.
      Parameters:
      showRowTotals - false if row totals shouldn't be shown and true otherwise
    • isRowTotalsShown

      Boolean isRowTotalsShown()
      Returns:
      false if row totals shouldn't be shown and true otherwise
    • setShowColTotals

      @StudioProperty void setShowColTotals(Boolean showColTotals)
      Set false if col totals shouldn't be shown and true otherwise. Works only for table renderers. true by default.
      Parameters:
      showColTotals - false if col totals shouldn't be shown and true otherwise
    • isColTotalsShown

      Boolean isColTotalsShown()
      Returns:
      false if col totals shouldn't be shown and true otherwise
    • setEmptyDataMessage

      @StudioProperty(type=LOCALIZED_STRING) void setEmptyDataMessage(String emptyDataMessage)
      Sets the message that will be displayed in case of empty data.
      Parameters:
      emptyDataMessage - the message that will be displayed in case of empty data
    • addRefreshListener

      Subscription addRefreshListener(Consumer<PivotTable.RefreshEvent> refreshListener)
      Adds a listener to the pivot table refresh events. Fired only for editable PivotTable.
      Parameters:
      refreshListener - a listener to add
      Returns:
      subscription
    • addCellClickListener

      Subscription addCellClickListener(Consumer<PivotTable.CellClickEvent> listener)
      Adds a listener to the pivot table cell click events. Fired only for table renderers (table, heatmap, table barchart, col heatmap, row heatmap).
      Parameters:
      listener - a listener to add
      Returns:
      subscription