ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: saritha on April 03, 2019, 08:00:37 pm

Title: exporting of nested grid
Post by: saritha on April 03, 2019, 08:00:37 pm
how to export nested grid in excel format .
Title: Re: exporting of nested grid
Post by: Hatmaker on April 19, 2019, 04:45:33 pm
Can you even export a nested grid directly into Excel?
Title: Re: exporting of nested grid
Post by: paramvir on April 21, 2019, 04:07:34 pm
Only single grid ( main or nested ) can be exported at a time into Excel
Title: Re: exporting of nested grid
Post by: tarunsharma on November 17, 2020, 11:05:13 pm
I am trying to export both parent and nested gird all together in one excel sheet, but the problem is it show few nested rows as blank even though they do have the values. The reason is when parent grid send the request to retrieve nested rows it will take time and before get the response back it will check next parent row. Can anyone suggest me any solution? I am doing something like this.

function exportSlow() {

            var grid = this,
                w = grid.exportExcel({ workbook: true, render: true }),
                wrows = w.sheets[0].rows,
                rows = [],
                i = 0,
                loading = grid.option('strLoading'),
                pdata = grid.pageData();

            grid.showLoading();

            rows.push(wrows[0]);//parent header row.

            var id = setInterval(function () {
                var rd = pdata;
                if (rd) {
                    rows.push(wrows[i + 1]);//parent data row.                               
                    var $detail = getDetail(grid, rd),
                        w2 = $detail.pqGrid('instance').exportExcel({
                            workbook: true,
                            render: true
                        });

                    w2.sheets[0].rows.forEach(function (rd2) {
                        //shift all cells to the right.
                        rd2.cells.forEach(function (cell) {
                            if (cell.indx != null)
                                cell.indx++;
                        })
                        //and add empty cell at beginning of every row.
                        rd2.cells.unshift({});
                        rows.push(rd2)
                    })

                    rows.push({})//empty row.
                    i++;
                    grid.option('strLoading', Math.round(i * 100 / pdata.length) + "%")
                }
                else {
                    clearInterval(id);
                    w.sheets[0].rows = rows;
                    var blob = pq.excel.exportWb({ workbook: w, type: 'blob' });//export 1st workbook into Excel file.
                    saveAs(blob, "pqGrid.xlsx");
                    grid.hideLoading();
                    grid.option('strLoading', loading);
                }
            });
        }