History: keep sorting on page change

This commit is contained in:
Ilya Kitaev
2016-11-06 15:33:41 +03:00
parent ff02cc0821
commit c89c25c8ed

View File

@@ -40,6 +40,11 @@ Rectangle {
id: root id: root
property var model property var model
QtObject {
id: d
property bool initialized: false
}
color: "#F0EEEE" color: "#F0EEEE"
function getSelectedAmount() { function getSelectedAmount() {
@@ -59,10 +64,13 @@ Rectangle {
onModelChanged: { onModelChanged: {
if (typeof model !== 'undefined') { if (typeof model !== 'undefined') {
selectedAmount.text = getSelectedAmount()
if (!d.initialized) {
// setup date filter scope according to real transactions // setup date filter scope according to real transactions
fromDatePicker.currentDate = model.transactionHistory.firstDateTime fromDatePicker.currentDate = model.transactionHistory.firstDateTime
toDatePicker.currentDate = model.transactionHistory.lastDateTime toDatePicker.currentDate = model.transactionHistory.lastDateTime
selectedAmount.text = getSelectedAmount()
/* Default sorting by timestamp desc */ /* Default sorting by timestamp desc */
/* Sort indicator on table header */ /* Sort indicator on table header */
@@ -72,8 +80,11 @@ Rectangle {
model.sortRole = TransactionHistoryModel.TransactionTimeStampRole model.sortRole = TransactionHistoryModel.TransactionTimeStampRole
model.sort(0, Qt.DescendingOrder); model.sort(0, Qt.DescendingOrder);
d.initialized = true
// TODO: public interface for 'Header' item that will cause 'sortRequest' signal // TODO: public interface for 'Header' item that will cause 'sortRequest' signal
} }
}
} }