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

Filter Widget: Pass row to filter functions. #367

Closed
gknights opened this issue Aug 30, 2013 · 3 comments
Closed

Filter Widget: Pass row to filter functions. #367

gknights opened this issue Aug 30, 2013 · 3 comments

Comments

@gknights
Copy link
Contributor

Currently filter functions only receive details of the cell on which they are filtering. By passing the row it means that he function can reference other table data.

This should only require an extension to the two calls to the format functions in findRows in format in jquery.tablesorter.widgets

This can be achieved by passing the Row's JQuery object $tr.eq(j) as a new 5th parameter

gknights added a commit to gknights/tablesorter that referenced this issue Aug 30, 2013
The JQuery object for the row is passed to the format functions as 5th
argument.
@TheSin-
Copy link
Collaborator

TheSin- commented Aug 30, 2013

before I accept this, WHY? all you are doing is passing more data making the heap larger but to what advantage since it's never used.

@gknights
Copy link
Contributor Author

The reason I needed it was because I had a filter that didn't directly relate to the column contents. I was filtering a list of products. The filter I wanted was on the class of product rather than individual product name. The class of product was available as a data-* attribute available on the row, but not in the product name cell itself and there wasn't a class column.

By passing in the Row, I was able to have the product name filter function extract that detail from the row as a whole. The existing parameters could only tell me about the cell contents, or its number.

Mottie added a commit that referenced this issue Sep 30, 2013
Add row as parameter to the format function calls #367
@Mottie
Copy link
Owner

Mottie commented Oct 11, 2013

All merged! Thanks for helping out!

@Mottie Mottie closed this as completed Oct 11, 2013
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