Skip to content

EuiInMemoryTable - Allow selection to place components to the left of search input  #443

Closed

Description

@nreese

I am trying to enable searching and selection on the same EuiInMemoryTable. I would like a delete button to be visible only when there are selected items. I would like the delete button to be placed to the left of the search input. Below is a mock screen of what I am trying to do.

selection needs to have a new property, PropTypes.node, that allows consumers to define what to display when items are selected. Then EuiInMemoryTable can display that node in the EuiFlexGroup that contains the search input.

image

cc @uboness

Activity

  1. uboness commented on Feb 23, 2018

    @uboness
    Contributor

    yea.. we can add that. originally the search bar was not supposed to be part of the table, but since we moved to a different model (all in-memory one) then all the functionality is encapsulated within the EuiInMemoryTable which kinda forced us to put the search bar in it... we now need to accommodate adding these selection actions.

    I'd go about it by adding tools under the selection prop... @snide do you want to keep it generic nodes or should we enforce some UI/UX guidelines (e.g. don't put more than one button).

  2. self-assigned this
    on Feb 23, 2018
  3. snide commented on Feb 23, 2018

    @snide
    Contributor

    @uboness I think it's OK to make it a generic node (you might want one for the right side as well). We can cover usage through guidelines.

  4. uboness commented on Feb 23, 2018

    @uboness
    Contributor

    I think I'll just do it exactly as the row items - you can either configure a default action or a custom one (which can effectively be anything)... keeps it consistent.

  5. uboness commented on Feb 23, 2018

    @uboness
    Contributor

    @snide what do we do when the search is not configured (so no search bar)? Should we support selection actions? it won't work well as without search and when there's no selection, there's nothing to show in the "toolbar"... but then when selection is show and we'll show the selection actions the table will "jump" down.

    I'd suggest that we only support selection actions when search is set... effectively we have a toolbar with a search bar and if selection is on we show the selection actions on that toolbar.

  6. nreese commented on Feb 23, 2018

    @nreese
    ContributorAuthor

    I think the toolbar should be able to work without search. The toolbar, which is just a FlexGroup, can have the following states

    No search, selection, no selected items - toolbar would be empty.
    No search, selection, selected items - toolbar would be FlexGroup with single FlexItem containing the selection action node.
    search, selection, no selected items - toolbar would be FlexGroup with single FlexItem containing the search input(s).
    search, selection, selected items - toolbar would be FlexGroup with FlexItem containing the selection action node, and a FlexItem containing the search inputs.

  7. uboness commented on Feb 23, 2018

    @uboness
    Contributor

    sure.. that's indeed all the possible options :)... but from UI/UX perspective I believe we should avoid making the UI "jump". When you have an empty toolbox it'll automatically collapse (otherwise there's be a strange gap above the table). Then when you show the selection actions, the table will "jump" down to accommodate the toolbar. We should avoid such things. A better solution would be to put the selection action somewhere else on the page that will not cause any component to "jump"...

    but I leave it to @snide to figure out the design here :)

  8. snide commented on Feb 24, 2018

    @snide
    Contributor

    I think anytime you have a list, you probably want search. If there's a possibility to have it without search, then I think it's fine for it to "jump". It's probably a pretty limited use case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions