Author Topic: Bug when grid inside a jQueryUI dialog  (Read 433 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
Bug when grid inside a jQueryUI dialog
« on: June 27, 2024, 03:25:00 pm »
If I create a jQuery UI dialog on while initialising a page, and the dialog is hidden (autoOpen set to false) and the dialog contains a pqGrid, I get the attached error in the console when the screen size changes but ONLY if the dialog has not been made visible yet.  Once the dialog has been made visible there is no problem.  The pqGrid only does this when virtualWin:true is set.

I changed line 27596 to the following which fixes the attached error as dims is not defined for a pqGrid that has never been visible:
Code: [Select]
htContClient = left ? dims.wdContClient : (typeof(dims)!=="undefined" ? dims.htContClient : 0),
The issue with above is that I then get an exception thrown caused by the if statement on 27622:

Code: [Select]
if (!(bottom >= 0) || !(top >= 0)) {
throw "top bottom NaN"
}

The exception doesn't cause any issues as far as I can tell.
« Last Edit: June 27, 2024, 03:30:07 pm by jplevene »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
Re: Bug when grid inside a jQueryUI dialog
« Reply #1 on: July 21, 2024, 08:38:29 am »
I fixed this by adding the following code:

Insert new line 27564 in calcTopBottom:
Code: [Select]
if(typeof(this.dims)==="undefined") return 0;
Insert new line 27655 in getLeft: (was 27654)
Code: [Select]
if(typeof(this.leftArr)==="undefined") return 0;
Will this fix or an alternative be added in the next release?

CAUSE

When the grid is added to a hidden jQuery UI dialog or a hidden grid and the parent or screen is resized, this bug appears.  If the parent is later made visible, then the bug stops happening because this.dimms and this.leftArr get defined on first visble refresh.
« Last Edit: July 21, 2024, 09:28:46 am by jplevene »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Bug when grid inside a jQueryUI dialog
« Reply #2 on: July 22, 2024, 02:52:59 pm »
Thanks, I would check this but if it's caused by using virtualWin option then it's a non issue because virtualWin has no use in a dialog window.

virtualWin is only used when browser window is used as viewport as in this example:

https://paramquery.com/pro/demos/virtual_window
« Last Edit: July 22, 2024, 02:55:10 pm by paramvir »

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 131
    • View Profile
Re: Bug when grid inside a jQueryUI dialog
« Reply #3 on: July 31, 2024, 09:02:01 pm »
When setting up in the column model, can I set virtualWin to false, then before data is loaded set it to true?