Solved Update sql data models
-
@Diarby said in Update sql data models:
setFilter(tr("subregionid = %1").arg(parentId));
Why are you translating that string ?
-
Hello,
Excuse me for late answering. It's not a translation but a way to pass parentId parameter. Taking into account your remark, I changed to QString("subregionid = %1").arg(parentId), the result is the same : child combo are not updated.I am confused but this code is so simple that I wonder what is wrong ?
-
Did you check the content of the model after applying the filter on the C++ side ?
-
Hello,
I did most checks in C++ and got the data for each parentId supplied as expected. But back to QML, the changes are not applied.
In theory the QML combo, updates are done when the control is activated : I send the selected ID to child model so it can update his data and applied it to combo.
Maybe I am wrong, but where ? -
Can you share your project ?
-
With pleasure. Whole project is compiled in world.7z (12 KiB) [0_1516430081478_world.7z](Uploading 100%)
I receive message that I don't have privilèges to upload files. May I send you by email ? -
Not pre-compiled, just the sources.
-
Hello ! I am happy to be back as politicians in my country blocked internet from saturday to wednesday. Please find here https://www.dropbox.com/s/6juslcf7dfkxk69/world.7z?dl=0 all sources of my project.
Thanks for your help. -
Your
where
close are wrong. For example, in SubRegionModel, it should besetFilter(QString("subregion.RegionId = %1").arg(parentId));
. -
Hello, I made corrections and it works !
My mistake were to not set the table's name as the class is subclassed a QSqlRelationalTableModel.
Thanks a lot for your help.