-
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
select2 add new row #1237
Comments
Hi @performiture! It looks like it's an issue with the encoding of filters for storage. I'll have this problem fixed shortly. |
Hi @Mottie, Thanks for fixing this.. I think I found another issue related to this. When I set select2 filter on the last column all rows will be filtered. Here is demo https://jsfiddle.net/igorsf/fynwfryk/2/ If you try to select a city column 5 you will not get results but if you try column 1 it works fine. |
Actually it wasn't related; but a fix is now available for the select2 filter formatter in the master branch. |
Thanks for such a quick turnaround! |
Well, I try 😦... someday I'll work on an update for the select2 filter formatter so it supports version 4+. |
Could you take a look at $('table').trigger("updateAll") event with of select2 filter formatter. In this example I am trying to change the filter_function on click but get an error |
The issue there was that the select2 file was still targeting a DOM node that was removed. So now it adds a class name to the cell and targets that instead. There was also an issue, which was fixed, that popped up in the Anyway, I wouldn't recommend using "updateAll" because it is meant to update the table after content in the The best method to update the filter widget would be to use the $('table').trigger("refreshWidgets", [true]); Here is an updated demo which is using an updated |
Thank you again! Both "updateAll" and "refreshWidgets" work now as described. It would be really great if select2 selected option was retained after refresh just like other filters. Here is a demo https://jsfiddle.net/igorsf/awueejkh/8/ If you select to filter by "10-100" and city "Los Angeles" and hit "Run" to refresh, the city filter selected option is empty. |
That demo is missing the Also, I had to make a few more tweaks to the select2 script, so please check the master branch. |
Mottie, I've been trying to make this work with async ajax call to populate table rows. Here is my demo When refreshing, the select2 filter (city) will go blank or show "no matching rows found". Interestingly, if I add |
Hmm, I got the options to start working, but the selection isn't being saved. Give me a bit more time to work on this problem. |
Sorry, I haven't had a chance to work on this issue... too many distractions. I'll try to get to it soon. |
Of course. Thank you for your fantastic work |
Bump. Would be nice to make progress on this. |
Hiya! Sorry for the loooong delay... Today I was working on finishing up the documentation on the new Mark widget. Once I get that done, this was the next thing on my to do list. I plan to have a new release available by this weekend. |
Ok, here is what I have figured out so far.
Current demo: https://jsfiddle.net/Mottie/fy9y6x7p/4/ To Do: get stickyHeaders to cooperate. |
Well, it's a circular problem... I have now traced the last issue to the filter widget when it binds the sticky header clone filter inputs. It's all very frustrating and time consuming. I decided not to hold off on the release I planned for this weekend. I'll continue to isolate the problem as I find time/motivation. |
Mottie, your demo (without sticky headers) works great if ajax takes longer to complete than tablesorter filterInit. When I tried it with real ajax call, it completed before savedFilters got initialized causing lastSearch to be overwritten with empty array. To reproduce this you can just lower the timeout to 30ms or so from 3 sec. Is there some way I can ensure the order of events here? |
Well, there have been some issues with race-conditions. This situation is another such case. The filter widget does wait until tablesorter has completed initialization before applying the saved search query. Triggering an "update" before the filter widget completes initialization does interfere with that sequence. Moving the code to store the saved filters to the |
I kind of made it work by timing the duration of ajax call and setting a minimum required timeout before calling update.
but now select2 input is updating only if another filter is set. The filter widget search shows "Starting filter widget search:" with all list of empty strings. If another filter is set both show up in filter widget search just fine. |
You may not need the |
The problem with moving ajax call to |
Ok, I think I got it mostly fixed now... I needed to add a slight delay before updating the filter formatter functions. So now this demo works, and it even works when the stickyHeaders widget is included; but the select2 within the sticky header isn't updated LOL.... one step at a time. |
I noticed you are setting but not using savedFilters variable in the demo. It works but as soon as I add timeout to simulate ajax request, it breaks on refresh. select2 input doesn't get set |
Oops, I should have fixed that... try this demo. |
It now works perfectly with "select2" input. However in my app, 1 out of 4 refreshes, the columns with "filter-select" class are loosing their selected values. I tried debugging it. When |
If the select2 input isn't updating, try triggering a |
select2 is updating just fine. Its the other filters like |
I can't duplicate that problem. Please modify this demo to show me the problem so I can troubleshoot it better. |
I am trying to add new row to the table with select2 filter. If you click "Add Row" the tbody will become blank until filter reset button is hit. Please see https://jsfiddle.net/igorsf/f69jte28/
The text was updated successfully, but these errors were encountered: