Discussion:
[Wt-interest] WComboBox using a proxy model: possible bug?
Aarón Bueno Villares
2016-04-16 17:18:10 UTC
Permalink
Sorry to ask so many things but, I think I've found a bug, or I'm doing
something wrong.

I have a model (a tablemodel), used by a WTableView, and a
WAbstractProxyModel which "proxies" that model as a list. I don't use a
WStringListModel because the "column" I'm using to deliver data from the
source model depend on the context and it's not fixed (and some other
obscure reasons that I no longer remember).

In a different "page" of my admin site, I use a WComboBox which uses that
proxy model to set the combobox data. However, if the current index of the
combobox is -1, but the source model changes for whatever reason, the
WComboBox is rendered as if the first element were selected. When the
currentIndex isn't -1, the problem doesn't seem to happen.

Specifically, before the source model changes, the "value" attribute of the
<select> DOM node is "", and, after changing the source model (a reset or
an insert row signal is thrown), is "0".

Which is even weirder, is that, "re"setting the currentIndex as -1 after
the change, doesn't work. Even, deleting the WComboBox and creating another
new one, doesn't solve the issue either. My Wt version is 3.3.4. The only
solution that I think could work is creating a WTimer to "change" the
WComboBox value to -1 after the change of source model and the page
re-rendering.

Peregring-lk,
Koen Deforche
2016-04-28 13:17:48 UTC
Permalink
That sounds like a bug in WComboBox: the possibility to have 'no selection'
is a relatively recent feature. Can you file it as a bug?
Post by Aarón Bueno Villares
Sorry to ask so many things but, I think I've found a bug, or I'm doing
something wrong.
I have a model (a tablemodel), used by a WTableView, and a
WAbstractProxyModel which "proxies" that model as a list. I don't use a
WStringListModel because the "column" I'm using to deliver data from the
source model depend on the context and it's not fixed (and some other
obscure reasons that I no longer remember).
In a different "page" of my admin site, I use a WComboBox which uses that
proxy model to set the combobox data. However, if the current index of the
combobox is -1, but the source model changes for whatever reason, the
WComboBox is rendered as if the first element were selected. When the
currentIndex isn't -1, the problem doesn't seem to happen.
Specifically, before the source model changes, the "value" attribute of
the <select> DOM node is "", and, after changing the source model (a reset
or an insert row signal is thrown), is "0".
Which is even weirder, is that, "re"setting the currentIndex as -1 after
the change, doesn't work. Even, deleting the WComboBox and creating another
new one, doesn't solve the issue either. My Wt version is 3.3.4. The only
solution that I think could work is creating a WTimer to "change" the
WComboBox value to -1 after the change of source model and the page
re-rendering.
Peregring-lk,
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications
Manager
Applications Manager provides deep performance insights into multiple
tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
witty-interest mailing list
https://lists.sourceforge.net/lists/listinfo/witty-interest
Loading...