diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index d902427..ff760c8 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -183,6 +183,16 @@ void ReportRender::initDatasources(){ } } +void ReportRender::initDatasource(const QString& name){ + try{ + if (datasources()->containsDatasource(name)) + datasources()->dataSource(name)->first(); + } catch(ReportError &exception){ + QMessageBox::critical(0,tr("Error"),exception.what()); + return; + } +} + void ReportRender::renderPage(PageDesignIntf* patternPage) { m_curentNameIndex = 0; @@ -222,7 +232,7 @@ void ReportRender::renderPage(PageDesignIntf* patternPage) BandDesignIntf* lastRenderedBand = 0; for (int i=0;idataBandCount() && !m_renderCanceled;i++){ lastRenderedBand = m_patternPageItem->dataBandAt(i); - initDatasources(); + initDatasource(lastRenderedBand->datasourceName()); renderDataBand(lastRenderedBand); if (idataBandCount()-1) closeFooterGroup(lastRenderedBand); } diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 4f39fb5..34f0e02 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -88,6 +88,7 @@ public slots: private: void renderPage(PageDesignIntf *patternPage); void initDatasources(); + void initDatasource(const QString &name); void initRenderPage(); #ifdef HAVE_UI_LOADER void initDialogs(); @@ -177,6 +178,7 @@ private: QList m_ranges; QVector m_columnedBandItems; unsigned long long m_curentNameIndex; + }; } // namespace LimeReport #endif // LRREPORTRENDER_H