This extension is a (now) basic wrapper for jqGrid. This is an early release, using jqGrid 3.5 beta. Please help testing it in as many browsers as possible, and post your comments on the board.
protected/extensionsSee the following code example:
$this->widget('application.extensions.jqgrid.EJqGrid', array( 'name'=>'jqgrid1', 'compression'=>'none', 'theme'=>'redmond', 'useNavBar'=>true, 'useNavBar'=>'false', 'options'=>array( 'datatype'=>'xml', 'url'=>'http://localhost/~metayii/yii-svn/demos/helloworld2/?r=site/list', 'colNames'=>array('Index','Aircraft','BuiltBy'), 'colModel'=>array( array('name'=>'id','index'=>'id','width'=>'55','name'=>'invdate','index'=>'invdate','width'=>90), array('name'=>'aircraft','index'=>'aircraft','width'=>90), array('name'=>'factory','index'=>'factory','width'=>100) ), 'rowNum'=>10, 'rowList'=>array(10,20,30), 'sortname'=>'id', 'viewrecords'=>true, 'sortorder'=>"desc", 'caption'=>"Airplanes from XML" ) ) );
where http://localhost/~metayii/yii-svn/demos/helloworld2/?r=site/list is an action which returns XML code, for instance:
class ListAction extends CAction { public function run() { $xml =<<<EOP <?xml version='1.0' encoding='utf-8'?> <rows> <page>1</page> <total>1</total> <records>4</records> <row id="1"> <cell>1</cell> <cell>F-14</cell> <cell>Grumman</cell> </row> <row id="2"> <cell>2</cell> <cell>F-15</cell> <cell>Boeing</cell> </row> </rows> EOP; header("Content-Type: application/xml"); header("Content-Length: " . strlen($xml)); echo $xml; } }
(you can construct the XML from a database recordset, for example)
Total 14 comments
Does it work only with xml elements ??
Can the extension access to database directly through ActionAdmin for example (or other) which is defined by gii by default instead of create an xml list ?
Updated this to the most recent version of Yii - 1.1.12.
I will be updating this plugin here:
https://github.com/TigerWolf/yii-jqgrid
doenst work with Yii 1.1.10 :(
hope new update, thks
There is a bug in EJqGrid.... you have to set path of js in line number 537 in EJqGrid. which have install from yii extension.
foreach ($plugins as $file)
{
$this->_clientScript->registerScriptFile($this->_baseUrl.'/plugins/'.$file);
}
.................................................
foreach($plugins as $file)
{
$this->_clientScript->registerScriptFile($this->_baseUrl.'/js/'.$file);
}
There is a bug in EJqGrid.... you have to set path of js in line number 537 in EJqGrid. which have install from yii extension.
foreach ($plugins as $file) { $this->_clientScript->registerScriptFile($this->_baseUrl.'/[color="#FF0000"][b]plugins[/b][/color]/'.$file); }
.............................................................................. foreach
($plugins as $file) { $this->_clientScript->registerScriptFile($this->_baseUrl.'/[color="#00FF00"]js[/color]/'.$file); }
There is a bug in EJqGrid.... you have to set path of js in line number 537 in EJqGrid. which have install from yii extension...... ................. foreach ($plugins as $file) { $this->_clientScript->registerScriptFile($this->_baseUrl.'/[color="#FF0000"][b]plugins[/b][/color]/'.$file); }
.............................................................................. foreach ($plugins as $file) { $this->_clientScript->registerScriptFile($this->_baseUrl.'/[color="#00FF00"]js[/color]/'.$file); }
line 340 in EJqGrid.php generates an error in my installation ....
Original line is ...
Note the double underscore at start and end
Possible correction on line 62 is ....
Again, note double underscore
as the title, how can i sumit the fix version to you?
on jqGrid official document is explain the api: http://www.secondpersonplural.ca/jqgriddocs/_2er0j2mvk.htm
so, i upload on my host, and you can refere the modification
http://php.21deke.com/.tmp/EJqGrid.txt
behind the "navBarOptions", has more settings~
like:
).navGrid( '#grid-pager', // options { search: false, addfunc: function() { window.location.href = url('/add'); }, editfunc: function(id) { window.location.href = url('/edit', {id: id}); } }, // edit { }, // add { }, // del { url: createUrl('del') } );current edition can not set this?
'addfunc' => 'js:function() { alert(1); }',
above code can work~
:)
on navBarOptions settings, how to set addfunc, editfunc, etc...
[code] 'navBarOptions' => array( 'search' => false, 'addfunc' => "function() { window.location.href = url('/add'); }", ), [/code]
the above code can't work
i found zii.widget.jui in svn!
this extension can use the zii.widget.jui to compile?
if use the zii, i can save more than disc space:)
How can I set up a theme for jqGrid? In official jqGrid documentation I found this:
In order to use jqGrid 3.5, first a UI theme css file should be loaded. Download the desired theme (or build a custom one) from jQueryUI site (www.jqueryui.com) and point in your link tag in head section the path to the theme css
where the path_to_ui_css_file is a valid path to the ui theme file
How can it maybe applyable to jqgrid extension?
Leave a comment
Please login to leave your comment.