@Marco: Thanks! works quite ok. Added one line bcz of PHP error: line 221 in CJuiJqGrid:
if (is_array($this->options['colModel']))
Are you developing it further? Would like to integrate filterToolbar, but perhaps you already did this.
@Marco: Thanks! works quite ok. Added one line bcz of PHP error: line 221 in CJuiJqGrid:
if (is_array($this->options['colModel']))
Are you developing it further? Would like to integrate filterToolbar, but perhaps you already did this.
Thanks!
Honestly I don’t use CJuiJqGrid for my projects, I’m using CGridViewUI (have a look eziiui in extensions repository - I will release a new version with minor improvements soon).
I don’t think to develop it again… but I’d be glad if you do it and share with me!
Marco
Okay will have a look at it.
Have seen CGridViewUI, and is much nicer than CGridView, but thought JqGrid looks a lot nicer to be honest . Also does have a lot of additional options too, and is pretty fast.
Can you tell me why you decided to use CGridViewUI? Thanks!
It’s simple!!
CGridViewUI is zii CGridView with jquery-ui theme support.
It’s all server-side with tons of code less compared to jqGrid that is client-side… it’s all javascript.
In this way I can develop quickly and in a clean way following “Yii’s directives”.
Manage applications is easier… table is only in one view file… and you don’t have to pass data column by column…
Do you have any idea why i get this.
missing ) in parenthetical
(function($){$.jgrid=$.jgrid||{};$.ext....p.id).resizable(opts)})}})})(jQuery);
in firebug.
It points me to the jquery.jqGrid.min.js
Mmmm… usually it gives this message when it can’t find the js script or if you provide jqGrid data in wrong format (for example wrong query or json format…).
Worked cause data where in wrong format.
No i am facing this
You can see it doesn’t show any data although the firebug returns.(The multiple returns are there because i echo in foreach )
The problem must be somewhere here…
Controller actionIndex
foreach($data as $row) {
$response->rows[]=array(
'id'=>$row->id,
'cell'=>array(
'codeid'=>$row->codeid,
'fullname'=>$row->fullname
)
);
}
or
views index.php
.....
'colNames'=>array('id','codeid'), // model attributes
'colModel'=>array( // optional, this is generated automatically from colNames if 'modelClass' is defined
array('index'=>'id','name'=>'id'),
array('index'=>'cell','name'=>'codeid')
),
.....
Your grid is configured to hold 2 columns, but you’re passing 3 columns of data.
Yes i corrected that.
No the private function prepareColumns() method has some problems.
You say in doc that it’s optional to use the colModel if we use colNames and modelClass.
A user above said to insert the
if (is_array($this->options['colModel']))
but don’t work either maybe it is
if (isset($this->options['colModel']))
?
Tried but didn’t work.
I mean i have
<?php
$this->widget('ext.eziiui.jqgrid.CJuiJqGrid', array(
'modelClass'=>'Person', // used for columns label
'htmlOptions'=>array(
'id'=>'grid'
),
'navbar'=>true,
'options'=>array(
'height'=>400,
'autowidth'=>true,
'datatype'=>'json',
'url'=>$this->createUrl('index'), // ajax request for data
'colNames'=>array('id','codeid','fullname'), // model attributes
// 'colModel'=>array( // optional, this is generated automatically from colNames if 'modelClass' is defined
// array('index'=>'id','name'=>'id'),
// array('index'=>'codeid','name'=>'codeid'),
// array('index'=>'fullname','name'=>'fullname')
// ),
'rowNum'=>20,
'rowList'=>array(20,50,100),
'sortname'=>'codeid',
'sortorder'=>"ASC",
'caption'=>"Grid title"
)
)
);?>
and get
And it’s obvious.
Sorry for error, but as I wrote a few posts ago, I’m using CGridViewUI instead jqGrid.
Anyway try to substitute the function and let me know if it’s ok… in this case I release a fix.
Sorry but now I don’t have time to test it…
Thanks
private function prepareColumns()
{
//$colModels = array_merge($this->options['colModel'],array());
if (!isset($this->options['colModel']) || !is_array($this->options['colModel']))
$this->options['colModel']=array();
$colModels=$this->options['colModel'];
foreach ($this->options['colNames'] as $i=>$colName)
{
$this->options['colNames'][$i]=$this->resolveLabel($colName);
$colTemplate=array('index'=>$colName,'name'=>$colName);
if(!is_array($colModels[$i])) $colModels[$i] = array();
$this->options['colModel'][$i]=array_merge($colTemplate,$colModels[$i]);
}
}
Didn’t work either it hits at line
if(!is_array($colModels[$i])) $colModels[$i] = array();
With error [color="#FF0000"]Undefined offset: 0[/color]
I have this error:
PHP Error
Description
Undefined variable: options
Source File
/var/www/stock/protected/extensions/eziiui/widgets/pagers/CLinkPagerUI.php(221)
00209: * Registers the needed js file.
00210: * @param string the js URL. If null, a default js URL will be used.
00211: * @since 1.0.2
00212: */
00213: public function registerScriptFile($url=null)
00214: {
00215: if($url===null)
00216: $url=CHtml::asset(dirname(__FILE__).'/../assets/pagersui/jquery.linkpagerui.js');
00217: $cs=Yii::app()->getClientScript();
00218: $id=$this->htmlOptions['id'];
00219: $cs->registerCoreScript('jquery');
00220: $cs->registerScriptFile($url);
00221: $cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').linkPagerUI($options);");
00222: }
00223: }
@ ymuskie
I’ll release a new eziiui version in a couple of days, I was thinking to wait for yii-1.1.5… but I have a new version with little improvements.
In the meantime just edit CLinkPagerUI.php and modify the line from
$cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').linkPagerUI($options);");
to
$cs->registerScript(__CLASS__.'#'.$id,"jQuery('#$id').linkPagerUI();");
is this thread is still active as i can see last post of "macro" is on 05-nov-09.?
i found eziiui a pretty good extension i have used it in my application and it works perfectly… but i dont see any difference between cgridview and CGridViewUI… as you have written you need to include jquery ui theme system… how can i include that? you mean to say install this extension?? http://www.yiiframework.com/extension/jui/
how can i include that in my application…? just extracting it in protected/extension directory will solve my problem? what eziiui extension is actually does? no documentation regarding that?
looking forward to hear.
Many thanks,
jack