Author Topic: Error: "no such method 'exportData' for pqGrid widget instance" when calling exp  (Read 3816 times)

hirehop

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Hello,

I am getting the following error when trying to export a pqGrid:
Uncaught Error: no such method 'exportData' for pqGrid widget instance

The error occurs on this line:
Code: [Select]
var blob = $("#grid").pqGrid("exportData", {
    filename: "Report",
    format: "xlsx",
    sheetName: "Sheet1"
});

What I have checked:

The grid loads and works normally (sorting, paging, etc.).

The error happens only when calling exportData().

It appears that the exportData method is not available on my pqGrid instance.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Please confirm your version of pqgrid.

Have you assigned exportData to grid instance anywhere in your code. Check for exportData string in your entire code.

hirehop

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Version 11

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
In version 11.0.0, the exportData method is now asynchronous, so you need to handle it using async/await (or .then() if you prefer).

Code: [Select]
var grid = $("#grid").pqGrid('instance');
var blob = await grid.exportData({
  filename: "Report",
  format: "xlsx",
  sheetName: "Sheet1"
});

For more details, please refer to the Upgrade Guide.

hirehop

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 46
    • View Profile
Thanks , it works