Hey Zhimin,

2008/7/25 zhimin song <[EMAIL PROTECTED]>:
>         I am making a TableSearch using TableView and AbstractItemModel, i
> want to realize the functions like OpenOffice's Data->Filter->AutoFilter.
>        But now, because Wt has not a hideRow() method for TableView, I use
> tow Data Model, one named **_data, the other is **_search_data,
> when users use ComboBox and AbstractItemModel::match(...), the new data is
> given to **_search_data, and at the same time
> TableView::setMode(**_search_data), It works well.
>        But when I update data on client side, I must set new data to
> TableView::model() [the current data model()], so there is some old data in
> another data model ( **_data or **_search_data), especially when users want
> to see another data show, (such as show all data like in OpenOffice
> AutoFilter), he is sure to see the old data.
>        I think, if Wt has a TableView::hideRow(int row) or hideRows(), I can
> use only one data model, and update the same model when needed, It will be
> synchronous.
>
>       is that right? or there is a good solution?

What you need here is an equivalent for Qt's QAbstractProxyModel and
QSortFilterProxyModel. Then, you have an intermediate model that
proxies the original model (i.e. your **_data) but does not copy the
data. Instead, changes are propagated to the original model.

There have already been discussions to implement this functionality,
but so far it has not happened yet... It does not require internal
logic of Wt -- a WAbstractProxyModel and WSortFilterProxyModel simply
reimplement WAbstractItemModel in a special way.

Regards,
koen

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to