panwid
panwid copied to clipboard
Filters no longer filtering
Hello. I am having trouble with filters being applied/removed in examples/datatable.py when I enter 'f', and 'F', respectively. My local workaround was to simplify the filter and call self.invalidate() as shown in the the attached diff. With the patch in place, entering 'f', works as expected (i.e., I am left with records 0-4 displayed). Note, however, that using the down arrow (or mouse wheel) to scroll past the last record results in an exception. Upon entering 'F', records 0-9 are displayed, and subsequent scrolling reveals additional records as expected. I see that both apply_filters() and clear_filters() in pandwid/datatable/datatable.py include a self.invalidate() statement, but in both cases that statement has been commented out. What's the current/proper way to have filter changes take effect and be rendered on the screen? Thanks. datatable.py.diff.txt
Just to set expectations here: the master branch of panwid
is very raw at this point, so you'll run into things like this. I'm pushing a lot of other changes into it and not paying much attention to regressions in other areas. Since the project I'm most focused on isn't currently using the filter functionality, it's broken, as you've discovered here.
With that said -- I'm actually not sure that filtering and pagination ever worked together properly. If it did, it was by accident, and recent changes in how rows are updated when the underlying data changes rather than reloading the entire table will make a solution difficult. I have a lot of other things on my plate right now, so it might be a while before I get to fixing this.
No worries ... Thanks for letting me know where you are at with respect to expectations. In the meantime, I'd like to keep moving forward on my project. Would you say that calling self.invalidate() is the best workaround until a preferred solution can be implemented, or is it going to cause other/new problems? Is the preferred solution easy to express in a paragraph or two? Perhaps, I can try to implement it locally and submit patch for consideration?
Try to upgrade to latest master and see if that works for you. It still won't work with pagination, and nothing else will until I get time to implement a more comprehensive solution for row filtering.
Er, pushed too soon. Try again with c972b45
Pulled and tested. Thanks!
Sorry, but I had to revert this change for now because it was breaking some other datatable functionality that I'm using right now. I've reopened this ticket as a reminder to fix this properly in a way that doesn't break other things.