Sorting in PostgreSQL
-
Hello!
- I have database PostgreSQL on Red Hat Linux.
- Driver QPSQL
- To own component inherited from QWidget and having in itself QTableView model QSqlTableModel is established
At submit change in a database there is a change of an order of lines in model: the line with last changed cell becomes last (below)
In such cases recommend to specify obviously a way of sorting of records by means of a method:
QSqlTableModel:: setSortBut the given method doesn't work: changes nothing, lines continue to "be dumped" as before.
Advise, please, as it is possible to keep an order of an arrangement of lines of model after submit.
P.S. It's warking on Qt 4.5.3 and QtCreator 1.2.1
-
Thank you, mohsen :)
It's a pity, but the concept of our project makes desirable not to use SQL level in this case but to stay at model level. -
Dear, Friends!
The question has dared:
@Qt (C++)
modelUI->database().transaction();
modelUI->setSort(0, Qt::AscendingOrder);
@Thanks!