I'm using the new API to set the width of my jqGrid like this:
$('#grid').jqGrid('setGridWidth', $(window).width() * 0.98);
The problem is that in IE7 I'm getting this error:
'p.cellLayout' is null or not an object
This only happens in IE7 (IE8, Firefox and C开发者_JAVA技巧hrome work fine). Has anybody else encounter this problem and fixed it?
Probably you try to use setGridWidth
function on the wrong place. I would recommend you to place this call inside of loadComplete
or gridComplete
event.
UPDATED: I have no IE7, so I can not test this problem. There are parameter cellLayout
of jqGrid which has default value 5 and is documented on http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options. This parameter are used inside of setGridWidth
function. If is not clear you me why this parameter should be null
, but you can verify this before calling of setGridWidth
. The construct alert($('#grid')[0].p.cellLayout);
will show you this value. You can try to set this value to 5 before calling of setGridWidth
, but if you really have this property as null
, you have definitively a problem somewhere else.
In all situations like your problem it is always good to post a code example in your question, so that other could reproduce your problem. Sometimes you have a real problem not on the place which you describe. So a code example is always very helpful.
精彩评论