Bug #3198
openWSortFilterProxyModel does not filter
0%
Description
I have a WTableView object connected to a model object of type WSortFilterModel which in turn is connected to an object of type WStandardItemModel. The tableview initially renders the data just fine. But when I try to filter, however, the data disappears from the tableview. Relevant code is below (I use a WTextEdit to input filter data and a WPushButton to trigger the filter on column 5 of in my model):
construction and initialization of filter model:
m_filter_model = new Wt::WSortFilterProxyModel(root())
m_filter_model->setSourceModel(m_orders_model);
m_filter_model->setDynamicSortFilter(true);
m_filter_model->setFilterRole(Wt::UserRole); /// btw, i also tried the DisplayRole. same behaviour.
Here I trigger the filter but the data in the view disappears:
void button_clicked()
{
m_filter_model->setFilterKeyColumn(5);
m_filter_model~~setFilterRegExp(m_filterEdit~~>text()); // I checked to make sure there is indeed the correct filter text.
}
Help is appreciated,
Thanks
suresh
Files
Updated by Koen Deforche over 9 years ago
- Status changed from New to Feedback
Hey,
Can you give an example of how the regular expression looks like? I can only guess that this isn't in the expected format?
Regards,
koen
Updated by Suresh Easwar over 9 years ago
- File Before.PNG Before.PNG added
- File After.PNG After.PNG added
I've attached two images. I was attempting to retrieve a single row based on a specific value in column 5 (ORDER_ID) - see Before.PNG. The After.PNG file shows what I see after the filter has been applied. When I clear the filter editbox and press the OK button all the rows are restored. Also .* seems to work but regexps like KGAN.* does not.
Thanks
Updated by Koen Deforche over 9 years ago
- Assignee set to Koen Deforche
Hey,
Wt::UserRole seems an odd choice, unless you actually specify proper UserRole data. If you do not have UserRole data then that would explain the behavior you see.
If you set Wt::DisplayRole then this should work, if not, can you isolate the code in a test case so that we can figure out what is the problem.
Regards,
koen