Html id on header

Tags: #<Tag:0x00007f8b1cf09070>

Greeting,

I need to use filter only on 1 or 2 column.

example:

Is it possible in the current handsontable version ?

If not, is it possible to add html id for each header cells ?

thanks

Hi @alexandre.quere

I’m glad to see you back on our forum.

Filters if enabled are added to all the columns. However, if you could share some more details maybe we’ll be able to do something.

  1. Do you set any other options beside filters in your dropdown menu?
  2. Do you want to show the [v] icon (dropdown menu) for 1 and 2 columns?
  3. Do you set fixed width for 1 and 2 columns?

Glad to see you too @aleksandra_budnik

indeed, I only want to show the [v] icon (dropdown menu) for currency code column and billing status column.

the filter config remain the same as usual:

hotSettings: Handsontable.GridSettings = {
    // General settings must apply to every handsontable
    // FIXME: Move to a generic place
    licenseKey: environment.hotLicenceKey,
    allowInsertColumn: false,
    allowRemoveColumn: false,
    contextMenu: true,
    filters: true,
    dropdownMenu: ["filter_by_condition", "filter_by_value", "filter_action_bar"],
    hiddenRows: false,
    manualColumnFreeze: true,
    manualColumnMove: false,
    observeChanges: true,
    undo: false,
    manualColumnResize: true,
    minSpareRows: 0,
    columnSorting: false,
    stretchH: 'all',
    height: 'calc(100vh - 2*64px)',
    width: '100%',
    renderAllRows: true,
  };

the simplest solution we found is to set the css property “display: none” to each unecessary header cell to filter. For this example, the [0,1,2,3,4] columns. To do that, we need a unique html identifier => html id.

By the way, I found this solution :

but it mean to fork and change the source code… It will stay my last option.

You can also do something like this https://jsfiddle.net/AMBudnik/mhajedz9/
It’s simple and it works with moving columns.

Your solution works perfectly.

As always, thank you for the support.
:grin::grin:

You’re welcome @alexandre.quere :slight_smile: