### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- controls »

# tableview

Tableview

class `camelot.view.controls.tableview.``AdminTableWidget`(admin, parent=None)

  A table widget that inspects the admin class and changes the behavior of the table as specified in the admin class

class `camelot.view.controls.tableview.``FrozenTableWidget`(parent, columns_frozen)

  A table widget to be used as the frozen table widget inside a table widget.

  `currentChanged`(current, previous)

    When the current index has changed, prevent it to jump to a column that is not frozen

class `camelot.view.controls.tableview.``HeaderWidget`(parent, admin)

  HeaderWidget for a tableview, containing the title, the search widget, and the number of rows in the table

  `decorate_query`(query)

    Apply expanded filters on the query

  `rows_widget`

    alias of `RowsWidget`

  `search_widget`

    alias of `SimpleSearchControl`

class `camelot.view.controls.tableview.``RowsWidget`(parent)

  Widget that is part of the header widget, displaying the number of rows in the table view

class `camelot.view.controls.tableview.``Splitter`

  Custom implementation of QSplitter to use the custom SplitterHandle

class `camelot.view.controls.tableview.``SplitterHandle`(orientation, splitter, widget_to_hide=None)

  Custom implementation of QSplitterHandle to provide more functions, such as hiding a widget by clicking the handle

class `camelot.view.controls.tableview.``TableView`(admin, search_text=None, parent=None)

  A generic tableview widget that puts together some other widgets. The behaviour of this class and the resulting interface can be tuned by specifying specific class attributes which define the underlying widgets used

      class MovieRentalTableView(TableView):
        title_format = 'Grand overview of recent movie rentals'

  The attributes that can be specified are :

  `header_widget`

  The widget class to be used as a header in the table view:

      header_widget = HeaderWidget

  `table_widget`

  The widget class used to display a table within the table view

  table_widget = TableWidget

  `title_format`

  A string used to format the title of the view

  title_format = ‘%(verbose_name_plural)s’

  `table_model`

  A class implementing QAbstractTableModel that will be used as a model for the table view

      table_model = QueryTableProxy

  - emits the row_selected signal when a row has been selected
  class `AdminTableWidget`(admin, parent=None)

    A table widget that inspects the admin class and changes the behavior of the table as specified in the admin class

  `TableView.``cancelSearch`()

    resets search filtering to default

  `TableView.``closeEvent`(event)

    reimplements close event

  `TableView.``copy_selected_rows`()

    Copy the selected rows in this tableview

  `TableView.``create_table_model`(admin)

    Create a table model for the given admin interface

  `TableView.``deleteSelectedRows`()

    delete the selected rows in this tableview

  `TableView.``getColumns`()

    return the columns to be displayed in the table view

  `TableView.``getData`()

    generator for data queried by table model

  `TableView.``getTitle`()

    return the name of the entity managed by the admin attribute

  `TableView.``get_collection_getter`(*args, **kwargs)

    Returns: | a list with all the objects corresponding to the rows in the table

  `TableView.``get_selection_getter`(*args, **kwargs)

    Returns: | a function that when called return an iterable with all the

    objects corresponding to the selected rows in the table.

  `TableView.``header_widget`

    alias of `HeaderWidget`

  `TableView.``importFromFile`()

    “import data : the data will be imported in the activeMdiChild

  `TableView.``newRow`(*args, **kwargs)

    Create a new row in the tableview

  `TableView.``rebuild_query`()

    resets the table model query

  `TableView.``refresh`()

    Refresh the whole view

  `TableView.``sectionClicked`(section)

    emits a row_selected signal

  `TableView.``selectTableRow`(row)

    selects the specified row

  `TableView.``selectedTableIndexes`(*args, **kwargs)

    returns a list of selected rows indexes

  `TableView.``set_admin`(*args, **kwargs)

    Switch to a different subclass, where admin is the admin object of the subclass

  `TableView.``set_filters_and_actions`(*args, **kwargs)

    sets filters for the tableview

  `TableView.``startSearch`(text)

    rebuilds query based on filtering text

  `TableView.``table_model`

    alias of `QueryTableProxy`

  `TableView.``to_html`()

    generates html of the table

  `TableView.``viewFirst`()

    selects first row

  `TableView.``viewLast`()

    selects last row

  `TableView.``viewNext`()

    selects next row

  `TableView.``viewPrevious`()

    selects previous row

class `camelot.view.controls.tableview.``TableWidget`(parent=None, columns_frozen=0, lines_per_row=1)

  A widget displaying a table, to be used within a TableView. This is a pumped up version of the QTableView widget providing extra functions such as frozen columns. But it does not rely on the model being Camelot specific, or a Collection Proxy.

  `margin`

  margin, specified as a number of pixels, used to calculate the height of a row in the table, the minimum row height will allow for this number of pixels below and above the text.

  `close_editor`()

    Close the active editor, this method is used to prevent assertion failures in QT when an editor is still open in the view for a cell that no longer exists in the model

    those assertion failures only exist in QT debug builds.

  `horizontal_section_clicked`(logical_index)

    Update the sorting of the model and the header

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »
- controls »

Comments
blog comments powered by Disqus