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

Tablesorter unable to filter externally on some columns. #1177

Closed
Manoj999 opened this issue Mar 11, 2016 · 8 comments
Closed

Tablesorter unable to filter externally on some columns. #1177

Manoj999 opened this issue Mar 11, 2016 · 8 comments

Comments

@Manoj999
Copy link

try {

    $table = $('#Tblgridinner').tablesorter({
        theme: 'blue',
        page: 0,
        size: 30,
        widgets: ["filter", "pager"],
        widgetOptions: {
            filter_external: '#Txtgridsearchresults',
            filter_liveSearch: false,
               }

    }).tablesorterPager({
        container: $(".pager"),
        output: '{startRow} - {endRow} / {filteredRows} ({totalRows})',
        page: 0,
        size: 10
    });

   }

This is my code.

I have one column with data is like this :1:20:30, this column I am unable to filter from external search input.

Please help me.

@Mottie
Copy link
Owner

Mottie commented Mar 11, 2016

Hi @Manoj999!

Would you modify this demo to include more data. I don't think that data would be detected as time, so the parser should be set to text - which should work.

@jwrichard
Copy link

Hi @Mottie ,

Thanks for all of your work, very appreciated.

I am experiencing the same/similar issue that Manoj is, and it is even happening in your external search demo page https://mottie.github.io/tablesorter/docs/example-widget-filter-external-inputs.html. Try changing the select box to first or last name, then typing in something.

If I try to filter on a single column instead of 'all', then it throws errors at jquery.tablesorter.widgets.js:1419
Uncaught TypeError: Cannot read property 'eq' of undefinedts.filter.matchType @ jquery.tablesorter.widgets.js:1419ts.filter.processRow @ jquery.tablesorter.widgets.js:1504ts.filter.findRows @ jquery.tablesorter.widgets.js:1759ts.filter.checkFilters @ jquery.tablesorter.widgets.js:1256(anonymous function) @ jquery.tablesorter.widgets.js:1195

Cheers

@Mottie
Copy link
Owner

Mottie commented Mar 24, 2016

Hi @jwrichard!

Thanks for that extra bit of info, it helped me find the bug! I will have it fixed here shortly. @Manoj999, please let me know if this fixes your issue.

The fix will be available in the master branch in the widget-filter.js source file and widget-filter.min.js dist file for now. I don't have a plan on when the next release will be available.

@jwrichard
Copy link

@Mottie Perfect! I'm excited to see that you were able to fix it. I just tested it out and it is working for me now. Thank you very much 👍

@Manoj999
Copy link
Author

Hi @jwrichard and @Mottie,

Hope you are doing well.

I have that issue previous later I added the property *filter_columnAnymatch:
false *so now I am able to search on all columns.

On Thu, Mar 24, 2016 at 8:33 PM, jwrichard notifications@github.com wrote:

@Mottie https://github.com/Mottie Perfect! I'm excited to see that you
were able to fix it. I just tested it out and it is working for me now.
Thank you very much [image: 👍]


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#1177 (comment)

Thanks And Regards,
Manoj.

@Manoj999
Copy link
Author

Hi @jwrichard and @Mottie,

Hope you are doing well.

  1. I have that issue previous later I added the property
    filter_columnAnymatch: false so now I am able to search on all columns from external filter.

  2. On column filtering also I have one issue, I had solved it but I would
    like to share with you. issue is,

    Data on column looks like: On Route To Final Destination,Arrived to
    offload Destination e.t.c..

    In the column filter textbox If I type On route to it is filtering
    correctly and If I paste complete text(i.e., On Route To Final Destination)
    or
    more than On Route to F unable to filter,I thought that it is not
    considering spaces correctly.

To solve above issue I used filter_functions option in the following way.

$table = $('#Tblgridinner').tablesorter({
        theme: 'blue',
        page: 0,
        size: 30,
        widgets: ["filter", "pager"],
        widgetOptions: {
            filter_external: '#Txtgridsearchresults',
            filter_liveSearch: false,
            filter_columnAnyMatch: false,
            filter_functions: {
                6: function (e, n, f, i, $r, c, data) {
                    e = e.toLowerCase().replace(/\s/g, "");
                    f = f.toLowerCase().replace(/\s/g, "");
                    if (e.indexOf(f) >= 0)
                    { return true; }
                    else { return false; }
                },
                7: function (e, n, f, i, $r, c, data) {
                    e = e.toLowerCase().replace(/\s/g, "");
                    f = f.toLowerCase().replace(/\s/g, "");
                    if (e.indexOf(f) >= 0)
                    { return true; }
                    else { return false; }
                }
            }
        }
    }).tablesorterPager({
        container: $(".pager"),
        output: '{startRow} - {endRow} / {filteredRows} ({totalRows})',
        page: 0,
        size: 10
    });

@Mottie Mottie removed the Next Update label Apr 1, 2016
@Mottie
Copy link
Owner

Mottie commented Apr 1, 2016

So @Manoj999, has this issue been resolved? Can I close it?

@Mottie
Copy link
Owner

Mottie commented Apr 30, 2016

I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread.

@Mottie Mottie closed this as completed Apr 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants