Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
450
Delay in Exporting to Excel Indication in hierarchical grid
posted

Hi Team,

I am using hierarchical grid wherein I have parent-child-subchild grid. When I click on Export to Excel button for exporting on a screen where we just have un-expanded parent grid, EXPORTING Indicator appears immediately.This was an ideal behavior.

But when we have expanded parent grid, child grid and sub-child grid and then if we click on Export to Excel button, I observed that EXPORTING Indicator is not appearing on the screen for a considerable amount of time. Screen looks blank and user may get confused if he/she has clicked the button.

Note - we had almost around 2000 nested records in this grid.

Following the the function we I written for exporting to excel -

function ExportToExcel() {
var exportingIndicator = $('<div>');
var parentval = 0;
var childval = 0;
var grandChildval = 0;
var gridExcelExporter = new $.ig.GridExcelExporter();
var $grid = $('#busServicePaymentReportGrid');
gridExcelExporter.exportGrid($grid, {
fileName: "BusServicePaymentReport",
gridStyling: "applied",
columnsToSkip: ["PARENT_KEY", "COMPOSITE_KEY", "BILL_DT"]
}, {
exportStarting: function (e, args) {
showExportingIndicator(args.grid, exportingIndicator);
},

//export date column in a proper format
cellExported: function (e, args) {
var parentCount = e._dataSource._data.length;
if (parentval < parentCount) {
var childCount = e._dataSource._data[parentval].busServicePayment.length;
if (childval < childCount) {
var grandChildCount = e._dataSource._data[parentval].busServicePayment[childval].busServicePaymentChild.length;

if (grandChildval < grandChildCount) {
if (args.columnKey == "BILL_DT_D") {
var rowIndexValue = args.rowId;

var colCellValue = e._dataSource._data[parentval].busServicePayment[childval].busServicePaymentChild[grandChildval].BILL_DT_D;
var val = formatDate(colCellValue);
args.xlRow.setCellValue(args.columnIndex, val);
grandChildval = grandChildval + 1;
if (grandChildval == grandChildCount) {
childval = childval + 1;
grandChildval = 0;
}
}
if (childval == childCount) {
parentval = parentval + 1;
childval = 0;
}
}
}
}
},
//Empty extra column header in parent grid
exportEnding: function (sender, args) {
var colsLength = $("#busServicePaymentReportGrid").igHierarchicalGrid("option", "columns").length - 1;
var colLayouts = $("#busServicePaymentReportGrid").igHierarchicalGrid("option", "columnLayouts");
var bandWithMostColumns = findMostColumns(colLayouts);

if (colsLength < bandWithMostColumns) {
var emptyValue = " ";

for (let index = colsLength; index <= bandWithMostColumns; index++) {
args.worksheet.rows().item(0).setCellValue(index, emptyValue);
emptyValue += " ";
}
}
},
success: function () {
hideExportingIndicator(exportingIndicator);
},
});
}

Is there a issue with infragistics or code? How do I solve the delay in exporting indicator issue?

  • 740
    Offline posted

    Hello,

    Thank you for posting in our community.

    I have created and attached a sample based on the provided code snippet. Note that I have commented out the handlers since there are a lot of dependencies not present, however, this should not affect the result. On my side, the exporting indicator works as expected.

    Please test the sample on your side and let me know how it behaves. If the sample is not working as per your expectation, please modify it so that it replicates the behavior and send it back to me for further investigation.

    Looking forward to hearing from you.

    2308.Sample.zip