Hello,
My user wants to edit several items at once using inline edit.
How can I do this with CGridView?
He narrows the list using the search form, then needs to change a couple of columns on each row.
Thanks
Frank
Hello,
My user wants to edit several items at once using inline edit.
How can I do this with CGridView?
He narrows the list using the search form, then needs to change a couple of columns on each row.
Thanks
Frank
You need to extend CGrideView for this
There are a few extensions that appear to do this.
I use DHTMLX Grid to do this.
Btw, there is now a post in dhtmlx blog (dhtmlx.com/blog/?p=1648) that explains how to use dhtmlxGrid (with inline editing) with Yii.
Has anyone gotten DHTMLX Grid integration to work without the grid returning all the rows in the table? In db_phpyii.php the select function’s
$res = $this->connection->findAll();
seems to superscede any attributes set in the controller. For example:
$grid = new GridConnector(Ps::model()->findByAttributes(array('server_id'=>$id)),"PHPYii" );
in mysql the log shows the attribute is attempted but then when its gets to dhtmlx connector code it’s ignored and all records are returned:
358 Query SHOW COLUMNS FROM `ps`
358 Query SHOW CREATE TABLE `ps`
358 Query SELECT * FROM `ps` `t` WHERE `t`.`server_id`=1 LIMIT 1
358 Query SELECT * FROM `ps` `t`
With criteria tosses an error:
$q = new CDbCriteria( array(
'condition' => "server_id = :sid", // no quotes around :match
'params' => array(':sid' => 1) // Aha! Wildcards go here
) );
$grid = new GridConnector(Ps::model()->findAll( $q ), "PHPYii");
I’d like to get DHTMLX grid integrated but I can’t find documentation or good examples on how to popluate the grid with just rows that match a foreign key vs entire table data.
Does anyone have a working example of this that they could share?
I do have it working using:
$gridConn = new GridConnector($res,"MySQL");
$gridConn->render_sql($sql,"id",[columns]);
Though it’d be great to use some sorta best practice and pipe through the PHPYii connector unless as I suspect it’s not designed to be that robust. Perhaps they are just providing a framework to build from but render_sql is quicker unfortunately. If anyone has this working through the PHPYii connector I’d love to see an example.