Author Topic: importWb return error  (Read 442 times)

NearEarthObject

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 30
    • View Profile
importWb return error
« 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
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

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: importWb return error
« Reply #1 on: September 15, 2023, 06:37:59 am »
Please follow this live example:

https://paramquery.com/pro/demos/js-workbook

NearEarthObject

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: importWb return error
« Reply #2 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 ??

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: importWb return error
« Reply #3 on: September 15, 2023, 01:27:25 pm »
Please add following to grid initalization options.

Code: [Select]
tabModel: {tabs: []},

NearEarthObject

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: importWb return error
« Reply #4 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 ?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: importWb return error
« Reply #5 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.

NearEarthObject

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 30
    • View Profile
Re: importWb return error
« Reply #6 on: September 15, 2023, 05:24:41 pm »
It works !!!

Thanks !!