Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Columns should be searchable via the API, even if they were disabled during DataTable initialization #210

Open
MisterVector opened this issue Jun 7, 2022 · 4 comments

Comments

@MisterVector
Copy link

Currently, attempting to search a column via the API when searching on that column has been disabled does not return anything. I'm posting this feature request because I think that some columns may not be appropriate to search on via the search field, however through one or more filters after a search, such a column ought to be searched on. I'll try to clarify with a proof of concept.

To play around with this POC yourself, I have provided the following gists:

eligibleEmployees.html: https://gist.github.com/MisterVector/6cbbb74b74d5af7556472ec8681a5b64
eligibleEmployees.js: https://gist.github.com/MisterVector/d8b7a6c3f7b02bfce2d268c86a720ea8

The POC starts off with this table:

image

Scenario 1 below illustrates my point that some columns aren't appropriate to search on:

image

Scenario 2 shows the "Show only employees eligible for promotion" option checked, which shows only the employees eligible for promotion:

image

With the "Disable third column for search?" item checked, scenario 3 shows that performing the same search will not show any results, as that column has been disabled:

image

For scenario 4, both checkboxes have been checked, which disables the third column for search and performs a search on that column using the API, which turns up no results:

image

I'm suggesting that scenario 4 should show the intended results, regardless if the searching capabilities of that column are disabled or not.

This probably makes more sense if the column was hidden. You would disable it at initialization to make sure the hidden column is not selected when searching but then perform a search on that column using the API.

@AllanJard
Copy link
Contributor

Yes, rather than just being a boolean option, it might be nice to allow it to be searchable: 'api'.

It isn't something I'm going to be adding soon though I'm afraid. This is the first request I can recall for this and it isn't something I've required myself yet. Will leave open for future thought.

@MisterVector
Copy link
Author

I brought this up because I spent several hours one day at work trying to figure out what was wrong with my code, only to realize towards the end (after going through 2 other developers) that I had set one of the columns to disabled, but also that column was being searched via the API.

@MisterVector
Copy link
Author

@AllanJard I've been working on a PR to address this issue. However, I noticed something interesting and would like your input.

I noticed that sometime back there was a change to the core.filter.js file adding an oInput.return argument when calling the _fnFilter() function:

image

However there is no such parameter in the _fnFilter() function. Here is its current signature:

image

Would you like me to remove the argument oInput.return in this PR or make a separate PR removing it? What do you see is the best path forward?

@AllanJard
Copy link
Contributor

Good spotting! I've gone ahead and fixed that, as it is just wrong. Thanks for letting me know!

AllanJard added a commit to DataTables/Dist-DataTables that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-DataTables that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-Bootstrap that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-Foundation that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-jQueryUI that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-SemanticUI that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-Bootstrap4 that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-Bootstrap5 that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
AllanJard added a commit to DataTables/Dist-DataTables-Bulma that referenced this issue Mar 20, 2023
…nt count on internal filtering call

Relates to DataTables/DataTablesSrc#210

df587f100c1f32013a0e07ccb8f96dea99e1cc3b Merge branch 'master' of github.com:DataTables/DataTablesSrc

Sync to source repo @df587f100c1f32013a0e07ccb8f96dea99e1cc3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants