Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Emit event on table selection #1810

Merged
merged 7 commits into from
Jan 26, 2023
Merged

feat: Emit event on table selection #1810

merged 7 commits into from
Jan 26, 2023

Conversation

marek-mihok
Copy link
Contributor

@marek-mihok marek-mihok commented Jan 26, 2023

Let's welcome the new member to our family of already supported table events, the select event!

The select event is emitted every time when there is a change in current table rows selection and contains the list of all selected item names. Here is an example:

Screen.Recording.2023-01-26.at.09.37.28.mov

This change also comes with the updated API description:

export interface Table {
  /** An identifying name for this component. */
  name: Id
  /** The columns in this table. */
  columns: TableColumn[]
  /** The rows in this table. Mutually exclusive with `groups` attr. */
  rows?: TableRow[]
  /** True to allow multiple rows to be selected. */
  multiple?: B
  /** True to allow group by feature. Not applicable when `pagination` is set. */
  groupable?: B
  /** Indicates whether the table rows can be downloaded as a CSV file. Defaults to False. */
  downloadable?: B
  /** Indicates whether a Reset button should be displayed to reset search / filter / group-by values to their defaults. Defaults to False. */
  resettable?: B
  /** The height of the table, e.g. '400px', '50%', etc. */
  height?: S
  /** The width of the table, e.g. '100px'. Defaults to '100%'. */
  width?: S
  /** The names of the selected rows. If this parameter is set, multiple selections will be allowed (`multiple` is assumed to be `True`). */
  values?: S[]
  /** Controls visibility of table rows when `multiple` is set to `True`. Defaults to 'on-hover'. */
  checkbox_visibility?: 'always' | 'on-hover' | 'hidden'
  /** True if the component should be visible. Defaults to True. */
  visible?: B
  /** An optional tooltip message displayed when a user clicks the help icon to the right of the component. */
  tooltip?: S
  /** Creates collapsible / expandable groups of data rows. Mutually exclusive with `rows` attr. */
  groups?: TableGroup[]
  /** Display a pagination control at the bottom of the table. Set this value using `ui.table_pagination()`. */
  pagination?: TablePagination
  /** The events to capture on this table. One of 'search' | 'sort' | 'filter' | 'download' | 'page_change' | 'reset' | 'select'. */
  events?: S[]
}

Closes #1654

@marek-mihok marek-mihok marked this pull request as ready for review January 26, 2023 09:24
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @marek-mihok! A few changes needed.

py/examples/table_events_select.py Outdated Show resolved Hide resolved
py/examples/table_events_select.py Outdated Show resolved Hide resolved
ui/src/table.tsx Outdated Show resolved Hide resolved
website/widgets/form/table.md Outdated Show resolved Hide resolved
mturoci
mturoci previously approved these changes Jan 26, 2023
Copy link
Collaborator

@mturoci mturoci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

py/examples/table_events_select.py Outdated Show resolved Hide resolved
website/widgets/form/table.md Outdated Show resolved Hide resolved
website/widgets/form/table.md Outdated Show resolved Hide resolved
@mturoci mturoci merged commit c5e2f22 into master Jan 26, 2023
@mturoci mturoci deleted the feat/issue-1654 branch January 26, 2023 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emit event on table selection
2 participants