Yii 1.1: jqgrid

jqGrid based grid
22 followers

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.

Checksums

  • cadb320e33d838fa068b978613b1b515 jqgrid-0.1.tar.bz2
  • 5cd470b7f59cc34cc1ddb999100f1832 jqgrid-0.1.zip

Resources

Documentation

Requirements

  • Yii 1.0 or above
  • jui extension

Installation

  • Install the jui extension
  • Extract the release file under protected/extensions

Usage

See 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)

Change Log

20090613 (0.1 beta)

  • Initial release.

Total 14 comments

#9956 report it
Zugluk at 2012/09/25 04:24am
question

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 ?

#9538 report it
Kieran at 2012/08/22 12:57am
Updated

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

#9008 report it
b3wii at 2012/07/12 09:17am
upd pls

doenst work with Yii 1.1.10 :(

#4794 report it
YiieHR at 2011/08/17 09:59am
jqgrid

hope new update, thks

#4191 report it
yii_developer at 2011/06/15 09:03am
bug in EJqGrid

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);

}

#4190 report it
yii_developer at 2011/06/15 09:00am
bug in EJqGrid

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); }

#4189 report it
yii_developer at 2011/06/15 08:59am
bug in EJqGrid

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); }

#2677 report it
Ivanda Nothabeer at 2011/01/26 08:30pm
Constant defined twice / undefined constant _CHECK_JS_PARAMETERS_

line 340 in EJqGrid.php generates an error in my installation ....

Original line is ...

if (__CHECK_JS_PARAMETERS__) self::checkOptions($value, $this->validOptions);

Note the double underscore at start and end

Possible correction on line 62 is ....

define('__CHECK_JS_PARAMETERS__', true);

Again, note double underscore

#1145 report it
jerry2801 at 2009/11/25 03:22am
i enhanced this extension~

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

#1146 report it
jerry2801 at 2009/11/25 01:38am
one more question~

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?

#1147 report it
jerry2801 at 2009/11/25 01:09am
i found the solution in source code~

'addfunc' => 'js:function() { alert(1); }',

above code can work~

:)

#1148 report it
jerry2801 at 2009/11/25 12:27am
how to set addfunc?

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

#1149 report it
jerry2801 at 2009/11/24 09:58am
jui extensions

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:)

#1270 report it
breakeneck at 2009/10/07 03:15am
Theme

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 to leave your comment.

Create extension