From afa3613542ddd1167e6a65dbf80c4d1d06eed626 Mon Sep 17 00:00:00 2001 From: Arin Alex Date: Mon, 14 Mar 2016 16:16:19 +0300 Subject: [PATCH] CallbackDatasourse has been fixed --- demo/r1/mainwindow.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/demo/r1/mainwindow.cpp b/demo/r1/mainwindow.cpp index 6b8b8fc..9452387 100644 --- a/demo/r1/mainwindow.cpp +++ b/demo/r1/mainwindow.cpp @@ -157,7 +157,7 @@ void MainWindow::prepareData(QSqlQuery* ds, LimeReport::CallbackInfo info, QVari break; case LimeReport::CallbackInfo::HasNext: data = ds->next(); - if (data.toBool()) ds->previous(); + ds->previous(); break; case LimeReport::CallbackInfo::ColumnHeaderData: if (info.index < ds->record().count()) @@ -179,10 +179,12 @@ void MainWindow::slotChangePos(const LimeReport::CallbackInfo::ChangePosType &ty { QSqlQuery* ds = m_customers; if (!ds) return; - if (type == LimeReport::CallbackInfo::First) result = ds->first(); - else result = ds->next(); - m_orders->bindValue(":id",m_customers->value(m_customers->record().indexOf("CustomerID"))); - m_orders->exec(); + if (type == LimeReport::CallbackInfo::First) {result = ds->first(); m_nextCount=0;} + else {result = ds->next(); m_nextCount++;} + if (result){ + m_orders->bindValue(":id",m_customers->value(m_customers->record().indexOf("CustomerID"))); + m_orders->exec(); + } } void MainWindow::slotGetCallbackChildData(LimeReport::CallbackInfo info, QVariant &data)