Project

General

Profile

Actions

Bug #3198

open

WSortFilterProxyModel does not filter

Added by Anonymous almost 10 years ago. Updated almost 10 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
Target version:
-
Start date:
05/24/2014
Due date:
% Done:

0%

Estimated time:

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

Before.PNG (32.4 KB) Before.PNG Suresh Easwar, 05/28/2014 05:51 PM
After.PNG (20.5 KB) After.PNG Suresh Easwar, 05/28/2014 05:51 PM
Actions #1

Updated by Koen Deforche almost 10 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 almost 10 years ago

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

Actions #3

Updated by Koen Deforche almost 10 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

Actions

Also available in: Atom PDF