Skip to content

datagrid-full.js initializes TomSelect without clear_button plugin #1279

@foxycode

Description

@foxycode

This means there is no way to clear a selected filter value. Once a user selects a filter value, there is no UI affordance to clear it back to the empty/unfiltered state - other than using the "Reset filter" button which clears all filters at once.

The issue is easy to reproduce at https://examples.contributte.org/datagrid-skeleton/outer-filters/

Suggested fix:

  1. In datagrid-full.ts (line 48):
// Before:
new SelectpickerPlugin(new TomSelect(Select)),

// After:                               
new SelectpickerPlugin(new TomSelect(Select, {
    plugins: ['clear_button'],
})),
  1. Would be also nice to add CSS to hide the clear button when no value is selected (placeholder state):
.ts-wrapper.single:not(.has-items) .ts-control .clear-button {
    display: none;
}

Maybe related to #671

Metadata

Metadata

Assignees

No one assigned

    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