Functionality ideas

Functionality ideas

fr3dfr3d Posts: 4Questions: 2Answers: 0

Hi',
I'm trying ColumnControl instead of manually manage column filters and I'd like to post some idea!

  1. An option to globally disabled the logic section (workaround via css)
  2. When the "inputmode" is set to "numeric" also set the type of the input as "number"
  3. Permit the use of normal select as column filter, actual workaround:
  DataTable.ColumnControl.content['searchSelect'] = {
    defaults: { options: [], placeholder: '' },
    init: function(cfg) {
      const dt = this.dt();
      const colIdx = this.idx();
      const select = document.createElement('select');
      select.classList.add('dtcc-search-select');

      // crea la tendina con la configurazione data
      cfg.options.forEach(function(opt) {
        const option = document.createElement('option');
        option.value = opt.value !== undefined ? opt.value : opt;
        option.textContent = opt.label !== undefined ? opt.label : opt;
        select.appendChild(option);
      });
      ...
      return select;
    }
  };
...

const states = [
  { "label": "All", "value": "" },
  {"label": "Working", value: "0"},
  ...
];

myTable = new DataTable('#table', {
    {
      target: 4,
      columnControl: [{
        extend: 'searchSelect',
        options: states
      }]
    }
  ]
});

Thanks in advance!
Federico

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,713Questions: 1Answers: 10,928 Site admin
    Answer ✓

    Hi Federico,

    Thanks for your message.

    1. The excludeLogic option exists on the search content types (e.g. -content searchText), but for a complete disablement, a CSS display: none on the select is probably the best option at the moment. I'll look at adding an option for that.
    2. That came up in this recent thread. I agree, I think that is a good idea.
    3. A -content searchList is currently the way to show a clickable list of options, but I can see that a simple select could be useful. That could certainly be added as a content type.

    Many thanks for the suggestions!

    Allan

  • fr3dfr3d Posts: 4Questions: 2Answers: 0

    Thanks Allan!
    I'll try to ask also another suggestion!
    With datatable is possibile to define a column not searchable with data-searchable html attribute. It would be interesting if ColumnControl would rely on this attribute to not add search fields in those columns

  • allanallan Posts: 65,713Questions: 1Answers: 10,928 Site admin

    At the moment I've taken the view that a ColumnControl search doesn't align with the searchable option - although I can see the benefit of adding that. Let me think about that one a bit and the ramifications :).

    Allan

Sign In or Register to comment.