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

Commands for Table Rows #897

Closed
mtanco opened this issue Jul 6, 2021 · 3 comments · Fixed by #1324
Closed

Commands for Table Rows #897

mtanco opened this issue Jul 6, 2021 · 3 comments · Fixed by #1324
Assignees
Labels
feature Feature request ui Related to UI

Comments

@mtanco
Copy link
Contributor

mtanco commented Jul 6, 2021

Is your feature request related to a problem? Please describe

When showing data in table, often there may be more than one action that could happen for each individual row. Today developers can create a button for each action and then the user would click the row and then click the button to get that specific action.

Describe the solution you'd like

The ability to have a ... as the last column in a table which shows a dropdown list of commands or actions when selected. From my perspective this makes sense as a command option for each ui.row but perhaps there are better ways to implement it.

Additional context

image

https://xd.adobe.com/view/57fcfe84-8e3a-4c64-ada0-f113ec8edb1a-02af/

@mtanco mtanco added the feature Feature request label Jul 6, 2021
@mtanco mtanco changed the title More Button Action - Tables Commands for Table Rows Jul 6, 2021
@mturoci mturoci added the ui Related to UI label Jul 6, 2021
@mturoci
Copy link
Collaborator

mturoci commented Sep 23, 2021

Proposed API:

/** Defines cell content to be rendered instead of a simple text. */
interface TableCellType {
  /** Renders a progress arc with a percentage value in the middle. */
  progress?: ProgressTableCellType
  /** Renders an icon. */
  icon?: IconTableCellType
  /** Renders a command menu. */
  command?: CommandTableCellType
}

/**
 * Create a cell type that renders command menu.
 *
 * Commands are typically displayed as context menu items. Useful when you need to provide
 * multiple actions within a single row.
 */
export interface CommandTableCellType {
  /** Items to render. */
  items: Command[]
 /** An identifying name for this component. */
  name?: S
}

@lo5 the biggest challenge here IMO is to come up with a sensible pattern on how to configure the values to be submitted - what values should q.args.command-name contain.

We can either:

  • Submit a row index - easy, but not sure if usable in real world scenarios.
  • Submit a serialized table row.
  • Use comma delimited string within table row cell (similar to table badges) and assume the order and number of entries matches command items.
  • Ask devs to provide a stringified map of key value pairs where key would have to match the command name and value would be a string that user wants to have submitted.

@lo5
Copy link
Member

lo5 commented Sep 24, 2021

what values should q.args.command-name contain.

Table rows have names. If the user clicks on a command named foo on a row named bar, I would expect q.args.foo='bar'.

Question: what's the use of CommandCellType.name?

@mturoci
Copy link
Collaborator

mturoci commented Sep 27, 2021

Table rows have names. If the user clicks on a command named foo on a row named bar, I would expect q.args.foo='bar'

Got it.

Question: what's the use of CommandCellType.name?

Used for just data-test attr within TableCellType in general (icon / progress etc.) to be easily selectable when e2e testing if needed.

@aalencar aalencar self-assigned this Apr 1, 2022
@aalencar aalencar linked a pull request Apr 4, 2022 that will close this issue
aalencar added a commit that referenced this issue Apr 4, 2022
aalencar added a commit that referenced this issue Apr 8, 2022
aalencar added a commit that referenced this issue Apr 8, 2022
aalencar added a commit that referenced this issue Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request ui Related to UI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants