When I will open a first page of second report I have this Error:
Code: Select all
[color=#FF0000]ERROR TypeError: Cannot read property 'sortingEnabled' of null[/color]
Code: Select all
const reportTermoAbertura = new Stimulsoft.Report.StiReport();
reportTermoAbertura.loadFile('../../../assets/ReportTermoAberturaEncerramento.mrt');
reportTermoAbertura.isAsync = true;
const reportLivroDiario = new Stimulsoft.Report.StiReport();
reportLivroDiario.loadFile('../../../assets/ReportLivroDiario.mrt');
reportLivroDiario.isAsync = true;
const reportTermoEncerramento = new Stimulsoft.Report.StiReport();
reportTermoEncerramento.loadFile('../../../assets/ReportTermoAberturaEncerramento.mrt');
reportTermoEncerramento.isAsync = true;
this.preencherEmpresaId();
const reportMerge = new Stimulsoft.Report.StiReport();
reportMerge.reportUnit = reportLivroDiario.reportUnit;
reportMerge.render();
reportMerge.renderedPages.clear();
const dbJsonAbertura = reportTermoAbertura.dictionary.databases.getByName('JSON');
dbJsonAbertura.pathData =
'https://localhost:44347/api/relatorio/TermoAberturaDiario?EmpresaId=' + this.empresaId +
'&EstabelecimentoId=' + this.estabelecimentoId + '&NumeroLivro=' + '1' +
'&DataEmissao=' + '13/09/2019' + '&DataEncerramentoExercicioSocial=' + '01/05/2019' +
'&DataPeriodoEscrituracaoInicio=' + this.dataInicial.toLocaleDateString() +
'&DataPeriodoEscrituracaoFinal=' + this.dataFinal.toLocaleDateString();
const dbLivroDiario = reportLivroDiario.dictionary.databases.getByName('LivroDiario');
dbLivroDiario.pathData =
'https://localhost:44347/api/relatorio/LivroDiario?DataInicio=' + this.dataInicial.toLocaleDateString() +
'&DataFim=' + this.dataFinal.toLocaleDateString() + '&EstabelecimentoId=' + this.estabelecimentoId +
'&EmpresaId=' + this.empresaId + '&QuebraPorMes=' + this.quebraMes;
this.impressaoContasEscolhidas.forEach(tipoImpressao => {
dbLivroDiario.pathData += '&' + tipoImpressao + '=true';
});
const dbJsonEncerramento = reportTermoEncerramento.dictionary.databases.getByName('JSON');
dbJsonEncerramento.pathData =
'https://localhost:44347/api/relatorio/TermoEncerramentoDiario?EmpresaId=' + this.empresaId +
'&EstabelecimentoId=' + this.estabelecimentoId + '&NumeroLivro=' + '1' +
'&DataEmissao=' + '13/09/2019' + '&DataEncerramentoExercicioSocial=' + '01/05/2019' +
'&DataPeriodoEscrituracaoInicio=' + this.dataInicial.toLocaleDateString() +
'&DataPeriodoEscrituracaoFinal=' + this.dataFinal.toLocaleDateString();
reportTermoAbertura.renderAsync(function () {
for (let index = 0; index < reportTermoAbertura.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportTermoAbertura.renderedPages.getByIndex(index));
}
});
reportLivroDiario.renderAsync(function () {
for (let index = 0; index < reportLivroDiario.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportLivroDiario.renderedPages.getByIndex(index));
}
});
reportTermoEncerramento.renderAsync(function () {
for (let index = 0; index < reportTermoEncerramento.renderedPages.count; ++index) {
reportMerge.renderedPages.add(reportTermoEncerramento.renderedPages.getByIndex(index));
}
reportMerge.renderedPages.list.forEach(function(page, i, arr) {
const paginacao = page.components.getByName('Paginacao');
if (paginacao) {
paginacao.text = 'Página ' + (i + 1) + ' de ' + reportMerge.renderedPages.count;
}
const textoCentral = page.components.getByName('TextoCentral');
if (textoCentral) {
textoCentral.text = textoCentral.text.replace(/{NumeroFolhas}/gi, '' + reportMerge.renderedPages.count);
}
});
});
this.viewer.report = reportMerge;
this.viewer.renderHtml('viewer');
Would you have any solution for this error? Thanks.