Author Topic: Error when using cancel to close up a detail row  (Read 2789 times)

CFGLife

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Error when using cancel to close up a detail row
« on: February 28, 2018, 06:56:05 am »
Pro version 5.1.0

I have built a grid using a combination of the 'Row Editing' demo and the 'Row Detail' demo where as part of editing a row you can expand details and edit info in a couple of tabs there.  However when I click on the Cancel button and Rollback all changes in the row and the detail grids and then set rowData.pq_detail.show = false I am getting the following error:

Uncaught TypeError: Cannot read property 'style' of null
    at pq.cRenderHead.setRowHtArr (pqgrid.dev.js:20625)
    at pq.cRenderHead.autoHeight (pqgrid.dev.js:19911)
    at pq.cRenderHead.<anonymous> (pqgrid.dev.js:21369)
    at pqgrid.dev.js:20650

I get this once for each grid that is in the row detail

However if I use setTimeout and do the rowData.pq_detail.show = false 500 milliseconds later then I do not get the error.  But if possible I would rather not do that it makes the application look sluggish. 

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: Error when using cancel to close up a detail row
« Reply #1 on: February 28, 2018, 04:44:58 pm »
rowCollapse method could be used.

https://paramquery.com/pro/api#method-rowCollapse

CFGLife

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Error when using cancel to close up a detail row
« Reply #2 on: March 01, 2018, 08:21:14 am »
Thank you

I tried using the rowCollapse method as suggested but I still get the  error in the browsers JS console

pqgrid.dev.js:20625 Uncaught TypeError: Cannot read property 'style' of null
    at pq.cRenderHead.setRowHtArr (pqgrid.dev.js:20625)
    at pq.cRenderHead.autoHeight (pqgrid.dev.js:19911)
    at pq.cRenderHead.<anonymous> (pqgrid.dev.js:21369)
    at pqgrid.dev.js:20650

However I can run the rowCollapse after a 300 millisecond setTimeout without needing a refresh and it works without the error.  So it seams from the error like something is trying to adjust some styles after the detail has closed and it is no longer visible and there are no longer any styles to work with

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: Error when using cancel to close up a detail row
« Reply #3 on: March 01, 2018, 07:26:43 pm »
Could you please share a jsfiddle for this one too.

Thanks