A few ColumnControl feature requests

A few ColumnControl feature requests

rickparrishrickparrish Posts: 3Questions: 1Answers: 0
edited December 2025 in Free community support

First off, I just wanted to say that ColumnControl is great! I was adding filtering textboxes/dropdown lists manually before I discovered it, which mostly worked but ColumnControl provides so much more functionality!

That said, there are a couple features I had implemented with my manual stuff that I'm missing in ColumnControl, which I hope could be considered for inclusion:

  1. Being able to programatically set the filters, eg on button click. Some of my tables have a lot of data/columns, and so I have buttons that allow the user to quickly filter to a subset of that data (one toggles values in five different dropdowns, so while the user could do the steps manually, it's a bit of work)
  2. Being able to set pre-defined filters (already asked here, so just adding I'd love this feature as well). Although if (1) is implemented, then this becomes less important as I could programatically set the filters after the table is loaded.
  3. Support a Between option for dates, so then for example these types of inputs could be supported:
    • 2024/07/01-2025/06/30
    • 2024/07-2025/06

Thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 65,588Questions: 1Answers: 10,904 Site admin

    Fantastic feedback - thank you. I've added 1 and 3 to my features list (2 is already there).

    The between option might be a little tricky. With two text box inputs, it would be straightforward - but I'm a little unsure about the UI for that (making it not ugly!). It will be possible, but I'm not certain how I'll implement it yet.

    It will likely be a little while before I work on this points I'm afraid - I'm neck deep in DataTables 3 development and all that is going with that.

    Allan

  • rickparrishrickparrish Posts: 3Questions: 1Answers: 0

    I did hack together a workaround for (2) using a global variable set in my page, which I then read from in the searchList init method.

    Do you think it's realistic for me to hack together something for (1) as well (and if so do you have any pointers)? Or because that would require my page to access the inner workings of columncontrol instead of simply having columncontrol reference a global variable like (2) did, maybe it's not realistic?

  • allanallan Posts: 65,588Questions: 1Answers: 10,904 Site admin
    Answer ✓

    With regard to setting a filter via an API, yes it can be done and I use it a lot in the unit tests - have a look here for example:

                $('thead tr:eq(1) td:eq(2) input')
                    .val('s')
                    .triggerNative('input');
    

    The triggerNative is use in the DataTables unit tests:

                $.fn.triggerNative = function (type) {
                    return this.each(function() {
                        this.dispatchEvent(new CustomEvent(type));
                    });
                };
    

    I've used jQuery for the unit tests for ColumnControl, as it just makes selecting etc easier. It could readily be done without if you wish.

    Setting a search term when the search input is in a dropdown is a little more complicated since you need to show the dropdown, set the value and then hide is, but is pefectly possible still.

    Allan

  • rickparrishrickparrish Posts: 3Questions: 1Answers: 0

    Thanks, that's exactly what I needed for the input-based filtering, and the searchList tests gave me what I needed for that type of filtering as well!

  • nlooijenlooije Posts: 56Questions: 13Answers: 0
    1. Support a Between option for dates

    I am also interested in this feature

    I understand that having two inputs in a cell using target: 1 may not be very aesthetically pleasing but having it as a button dropdown in the header and adding a second input is not bad looking in my opinion.

  • allanallan Posts: 65,588Questions: 1Answers: 10,904 Site admin

    That looks really nice - thanks for the suggestion :).

    Allan

  • WernfriedWernfried Posts: 26Questions: 5Answers: 0

    In my table I added some pre-defined ranges like "last week", "this month", etc. I use Server-Side processing where I have full control over what is shown in the table and what is not shown.

Sign In or Register to comment.