Aarón Bueno Villares
2016-04-16 17:18:10 UTC
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,
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,