ParamQuery grid support forum

General Category => Help for ParamQuery Pro => Topic started by: NearEarthObject on September 14, 2023, 11:29:35 pm

Title: importWb return error
Post by: NearEarthObject on September 14, 2023, 11:29:35 pm
Hi !

I am trying to use importWb method without any success, original goal was to create a json var create a new grid, facing some issus, I came back to the most basic and unique exemple provided here :
https://paramquery.com/pro/api#method-importWb (https://paramquery.com/pro/api#method-importWb)
But I always came back with the following error :

jquery-3.7.1.min.js:2 Uncaught TypeError: h.forEach is not a function
    at m.getRulesFromCM (pqgrid.min.js:9:196910)
    at m.filterLocalData (pqgrid.min.js:9:194997)
    at t._onDataAvailable (pqgrid.min.js:9:134996)
    at A.refreshDataAndView (pqgrid.min.js:9:63066)
    at E.cImport.importWb (pqgrid.min.js:9:267790)
    at E.pqGrid.importWb ....

Any idea to fix my issue, do I operate something wrong ??

Thanks in advance
Title: Re: importWb return error
Post by: paramvir on September 15, 2023, 06:37:59 am
Please follow this live example:

https://paramquery.com/pro/demos/js-workbook
Title: Re: importWb return error
Post by: NearEarthObject on September 15, 2023, 12:58:03 pm
Thanks It works :)

Only one thing, my wb json contain 2 "spreadsheet" tabs, I understood that tabs management relay to Ultimate or Enterprise package, I switch to ultimate.

Once json loaded, only the first tab appear. Withpout mention, and not the second one.

Any clue to fix it ??
Title: Re: importWb return error
Post by: paramvir on September 15, 2023, 01:27:25 pm
Please add following to grid initalization options.

Code: [Select]
tabModel: {tabs: []},
Title: Re: importWb return error
Post by: NearEarthObject on September 15, 2023, 02:22:08 pm
I already add it,
hereunder the object code :

obj = {
        height: 700,
        width: '100%',
        scrollModel: {
            autoFit: 1,
        },
        wrap: 1,
        autofill: 1,
        numberCell: {
            show: 0,
        },
        showHeader: 1,
        showToolbar: 1,
        showTop: 1,
        resizable: 1,
        columnBorders: 0,
        collapsible: 0,
        freezeCols: 0,
        autoAddRow: 1,
        autoAddCol: 1,
        rowBorders: 0,
        stripeRows: 0,
        selectionModel: {
            type: 'cell',
        },
        editable: 1,
        editor: {
            style: {
                width: 1,
            },
        },
        showTitle: 0,
        fillHandle: 'all',
        filterModel: {
            hideRows: 1,
        },
        sortModel: {
            on: 0,
        },
        autoRowHead: 1,
        autoRow: 1,
        toolbar: {
            items: [{
                type: 'button',
                label: 'Export Excel',
                cls: 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only',
                listener: exportXlsx,
            }, {
                type: 'button',
                label: 'Export PDF',
                cls: 'ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only',
                listener: exportPDF,
            }, ],
        },
        complete: function() {
            window.dispatchEvent(new Event('resize'));
        },
       
        editModel: {
            addDisableCls: 1,
        },
        tabModel: {
            tabs: [],
        },
    };

But it's not working,

I notice that tabs are situated in a div .pq-tabs-strip, into the div .pq-grid-bottom, in my case   the div .pq-tabs-strip do not exist.

Any idea ?
Title: Re: importWb return error
Post by: paramvir on September 15, 2023, 03:28:16 pm
It won't work with Enterprise SDK.

Please try it with Ultimate SDK and kindly ensure to hard refresh your browser cache.
Title: Re: importWb return error
Post by: NearEarthObject on September 15, 2023, 05:24:41 pm
It works !!!

Thanks !!