-
Notifications
You must be signed in to change notification settings - Fork 754
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 request #292
Comments
decided to use a second class to it will look like class="filter-select only-avail" First change in jquery.tablesorter.widgets.js:515
to
|
WIP, hometime so wanted to post this so far Second change in jquery.tablesorter.widgets.js:469
to
|
I think I understand what you are getting at... maybe an easier solution would be to add a class name for "onlyavail" and do this (off the top of my head): // loop through the rows
for (j = 0; j < l; j++){
// if onlyavail it set, use it to match the row class name
if (onlyavail && c.cache[k].row[j][0].className.match(onlyavail)) {
arry.push( '' + c.cache[k].normalized[j][i] );
} else if (wo.filter_useParsedData) {
// get non-normalized cell content It would help if you had some example HTML for the tbody so I can test it out ;) |
getting the class from the obj was all I needed, I just need to check if it doesn't has the filtered class on the row and I'll be set. as for test data anything will work. http://mottie.github.io/tablesorter/docs/example-widget-filter-custom.html Col0, select Peter Col2 should only have Seattle and Milwaukee in it instead of all results since the others are now unavail. |
I think the ts.addWidget({
id: "filter",
priority: 50,
options : {
onlyAvail: '',
filter_childRows : false, // if true, filter includes child row content in the search
... |
I'm not sure that is going to work TBH, I just finished the above code which should work, BUT since buildSelect() is never called between filters it won't repopulate. example. when I select col0 to Peter, it doesn't run anything to force Col2 to rebuild it's select box. They are only populated at the start, I will require it to re update on filterEnd or something :\ though adding it as a class or option is fine but I may not want all selects in a table to use it. in my case it's for a list of products and based on the type of products I only want the models of that type to show up in the filter select. Colors on the other hand could so them all cause they are all available as an option whether in stock or not. |
Second change in jquery.tablesorter.widgets.js:573
to
Now i just need to make sure the current value is selected so it doesn't reset the filters |
Nice it's actually working! now if only I can figure out how to not reset the current selection and I'm set! |
And Done!!! WORKING!! Forth change in jquery.tablesorter.widgets.js:497
to
|
hope it helps it works great! http://mottie.github.io/tablesorter/docs/example-widget-filter-custom.html just add the class 'only-avail' to col2 and you'll see it work! can't upload the file here but if you want it as a diff or just the full js file shoot me an email, it's very useful! |
Thanks! I'd appreciate the file and a demo ;) My gmail user name is wowmotty :) |
Sent, I just copied your online very and forced the local jquery.tablesorter.widgets.js I only added the only-avail to the city filter (col2) if you have any questions just msg me back. |
get a chance to check it out? I have it out in my production env now to really test it. |
I have checked it out, thanks! I will include it in my next update. My only thoughts are... I know you have a use for it, but I couldn't picture how to make a demo that would show it's full potential. With the modified demo you shared, it just seems like an extra step for me to filter a different name, but I'm sure it works better in your case... probably with a lot more elements in the dropdown. |
Sorry I forgot to include this in the last update (v2.10.0)... I'll be sure to include it in the next one! |
I'd like to request a filter-select-available.
based on this
http://stackoverflow.com/questions/16343048/tablesorter-custom-filter-to-show-only-available
I need to have some of my filter-select boxes to only provide a list of available (rows without the 'filtered' class)
I can not seem to figure out how to do this with custom filters so I'm not working in filters to try and add one. I wanted to make this request so I have some place to post it to after it's done.
The text was updated successfully, but these errors were encountered: