Author Topic: Change height of the grid at run time  (Read 5446 times)

Walker

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 4
    • View Profile
Change height of the grid at run time
« on: March 15, 2018, 09:27:08 am »
Hi everyone,

I'm evaluating ParamGrid and ParamGridPro, I would like to know if it's easy to change a grid size at run time (after the grid has been initialized and filled)

Note :
I'm using a "dynamic layout" where the user can change the width / height of "windows" with splitters, that is why I need to adapt the grid's size

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change height of the grid at run time
« Reply #1 on: March 15, 2018, 09:38:44 am »
Easy way is to set grid size in %

Other way is to listen to resize event of splitters and refresh grid size.

Walker

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Change height of the grid at run time
« Reply #2 on: March 15, 2018, 11:00:14 am »
Do you have a code example how to refresh the grid size (ex. in pixels)

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change height of the grid at run time
« Reply #3 on: March 15, 2018, 09:35:39 pm »
Code: [Select]
$grid.pqGrid('option', 'height', '600px').pqGrid( 'refresh' );

Walker

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Change height of the grid at run time
« Reply #4 on: March 16, 2018, 01:27:34 am »
Sorry but it doesn't seems to work
My Grid works, it's displayed correctly, but when I apply the code , the grid is emptied, all the rows disappear
I checked the height parameter, tested with a "direct" value (ex. "600px""), still the same problem

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Change height of the grid at run time
« Reply #5 on: March 16, 2018, 05:40:04 pm »
Sorry there can't be 'px' in the height option value.

Code: [Select]
$grid.pqGrid('option', 'height', 600).pqGrid( 'refresh' );

Walker

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Change height of the grid at run time
« Reply #6 on: March 17, 2018, 12:29:14 pm »
Thanks, without the "px" it works perfectly  8)