0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-26 01:24:39 +03:00

Merge branch 'master' into develop

# Conflicts:
#	limereport/lrreportrender.cpp
This commit is contained in:
Arin Alexander 2017-06-12 13:39:36 +03:00
commit 4ca7d7176b
3 changed files with 18 additions and 8 deletions

View File

@ -673,12 +673,15 @@ void CallbackDatasource::first(){
QVariant CallbackDatasource::data(const QString& columnName) QVariant CallbackDatasource::data(const QString& columnName)
{ {
CallbackInfo info;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = m_currentRow;
QVariant result; QVariant result;
emit getCallbackData(info,result); if (!eof()) //Don't read past the end
{
CallbackInfo info;
info.dataType = CallbackInfo::ColumnData;
info.columnName = columnName;
info.index = m_currentRow;
emit getCallbackData(info,result);
}
return result; return result;
} }

View File

@ -53,6 +53,7 @@ public:
virtual bool next() = 0; virtual bool next() = 0;
virtual bool hasNext() = 0; virtual bool hasNext() = 0;
virtual bool prior() = 0; virtual bool prior() = 0;
virtual void undoPrior() = 0;
virtual void first() = 0; virtual void first() = 0;
virtual void last() = 0; virtual void last() = 0;
virtual bool bof() = 0; virtual bool bof() = 0;
@ -354,6 +355,7 @@ public:
bool next(); bool next();
bool hasNext(); bool hasNext();
bool prior(); bool prior();
void undoPrior() {m_curRow++;}
void first(); void first();
void last(); void last();
bool eof(); bool eof();
@ -384,6 +386,7 @@ public:
bool next(); bool next();
bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;} bool hasNext(){ if (!m_eof) return checkNextRecord(m_currentRow); else return false;}
bool prior(){ if (m_currentRow !=-1) {m_currentRow--; return true;} else return false;} bool prior(){ if (m_currentRow !=-1) {m_currentRow--; return true;} else return false;}
void undoPrior() {m_currentRow++;}
void first(); void first();
void last(){} void last(){}
bool bof(){return m_currentRow == -1;} bool bof(){return m_currentRow == -1;}

View File

@ -691,8 +691,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
IGroupBand* gb = dynamic_cast<IGroupBand*>(band); IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
if (gb&&gb->isNeedToClose(datasources())){ if (gb&&gb->isNeedToClose(datasources())){
if (band->childBands().count()>0){ if (band->childBands().count()>0){
dataSource->prior(); bool didGoBack = dataSource->prior();
foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) { foreach (BandDesignIntf* subBand, band->childrenByType(BandDesignIntf::GroupHeader)) {
foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){ foreach(BandDesignIntf* footer, subBand->childrenByType(BandDesignIntf::GroupFooter)){
renderBand(footer, 0); renderBand(footer, 0);
@ -704,7 +703,12 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
renderBand(footer, 0, StartNewPageAsNeeded); renderBand(footer, 0, StartNewPageAsNeeded);
} }
dataSource->next(); if (didGoBack)
{
//New Method to undo prior... Alternatively pass in bool isUndoPrior into next()
dataSource->undoPrior();
//dataSource->next(); //Also emit changePos, which it should not at this point
}
} }
closeDataGroup(band); closeDataGroup(band);
} }