Class NativeTable

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.NativeTable
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<NativeTable>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, Serializable

@Tag("table") public class NativeTable extends com.vaadin.flow.component.HtmlContainer implements com.vaadin.flow.component.ClickNotifier<NativeTable>
Component representing a <table> element.
Since:
24.4
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty table.
    NativeTable(com.vaadin.flow.component.Component... components)
    Creates a new table with the given children components.
  • Method Summary

    Modifier and Type
    Method
    Description
    Adds a new body element to the table.
    Returns the list of <tbody> elements in this table.
    Returns the first body element in this table.
    getBody(int index)
    Returns the <tbody> element at a given position relative to other <tbody> elements.
    Return the table's caption component.
    Return the caption text for this table.
    Returns the <tfoot> element of this table.
    Returns the head of this table.
    void
    Removes the first body element in the list of bodies of this table.
    void
    removeBody(int index)
    Removes a body element at a given position.
    void
    Removes a body element from the table.
    void
    Remove the caption from this table.
    void
    Removes the foot from this table, if present.
    void
    Remove the head from this table, if present.
    void
    Sets the caption text for this table.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    getText, getWhiteSpace, setText, setWhiteSpace
  • Constructor Details

    • NativeTable

      public NativeTable()
      Creates a new empty table.
    • NativeTable

      public NativeTable(com.vaadin.flow.component.Component... components)
      Creates a new table with the given children components.
      Parameters:
      components - the children components.
  • Method Details

    • getCaption

      public NativeTableCaption getCaption()
      Return the table's caption component. Creates a new instance if no caption is present.
      Returns:
      the table's caption.
    • getCaptionText

      public String getCaptionText()
      Return the caption text for this table.
      Returns:
      the table's caption text.
    • setCaptionText

      public void setCaptionText(String text)
      Sets the caption text for this table.
      Parameters:
      text - the caption's text
    • removeCaption

      public void removeCaption()
      Remove the caption from this table.
    • getHead

      public NativeTableHeader getHead()
      Returns the head of this table.
      Returns:
      This table's <thead> element. Creates a new one if no element was present.
    • removeHead

      public void removeHead()
      Remove the head from this table, if present.
    • getFoot

      public NativeTableFooter getFoot()
      Returns the <tfoot> element of this table.
      Returns:
      The <tfoot> element of this table. Creates a new one if none was present.
    • removeFoot

      public void removeFoot()
      Removes the foot from this table, if present.
    • getBodies

      public List<NativeTableBody> getBodies()
      Returns the list of <tbody> elements in this table.
      Returns:
      the list of table body elements of this table.
    • getBody

      public NativeTableBody getBody()
      Returns the first body element in this table. Creates one if there's none.
      Returns:
      the first <tbody> element in the table. Creates one if there's none.
    • getBody

      public NativeTableBody getBody(int index)
      Returns the <tbody> element at a given position relative to other <tbody> elements.
      Parameters:
      index - The position of the body element relative to other body elements.
      Returns:
      The table body component at the given position. If the position is 0 and there are no body elements present, a new one is created and returned.
    • addBody

      public NativeTableBody addBody()
      Adds a new body element to the table.
      Returns:
      The new body.
    • removeBody

      public void removeBody(NativeTableBody body)
      Removes a body element from the table.
      Parameters:
      body - The body component to remove.
    • removeBody

      public void removeBody(int index)
      Removes a body element at a given position.
      Parameters:
      index - The position of the body element to remove.
    • removeBody

      public void removeBody()
      Removes the first body element in the list of bodies of this table.