ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: sudhir on April 29, 2014, 07:58:39 pm

Title: CSS Style
Post by: sudhir on April 29, 2014, 07:58:39 pm
I want to set height and width in % format how to do this.
Title: Re: CSS Style
Post by: sh4k on May 14, 2014, 03:24:30 pm
There is no way to specify %.

Work around would be to calculate the width and height of the parent component and set the width and height of the grid.

For example, consider this to be the parent element and grid :

HTML:
Code: [Select]
<div id="control">
<div id="grid_array"></div>
<div>

Javascript:

For the first page load, before the grid is created, try something like this(inside jQuery ready function)-

Code: [Select]
//parent container height
var ht = $("#control").height();
//parent container width
var wd = $("#control").width();

//use the width and height vars while creating the grid
var obj = { width: wd, height: ht, title: "",resizable:false,draggable:false}; //change other options as required
Next up, on window resize :

Code: [Select]
$(window).resize(function () {
var ht = $("#control").height();
var wd = $("#control").width();
var grid = $("#grid_array");
grid.pqGrid("option", { width: wd, height: ht});
}


You might want to check out if width() and height() work for you, otherwise try inner* and outer* functions.