In my Yii controller - actionGrid_data() looks like this:
public function actionGrid_data()
{
//MySQL data driver
//PHPYii data driver
//$res=mysql_connect("localhost","root","root");
//mysql_select_db("srv28064_giorni");
//$grid = new GridConnector($res, "MySQL");
$grid = new GridConnector(Lines::model(), "PHPYii");
//$options = new OptionsConnector($res);
//$options->render_table("people","id","id(value),name(label)");
//$grid->set_options("coro_column",$options);
$grid->event->attach("beforeRender","color_rows");
$grid->set_options("status", array("0"=>"status 1", "1"=>"status 2"));
$grid->configure("-", "id", "people_id, text, status");
$grid->render();
}
It works good but… I want get rows from database only with “status=1” to have a dhtmlxGrid filled with lines with status=1.
So I try to write Yii code in grid connector - Lines::model()->findAll(array(“condition”=>“status = 1”,“order”=>“id”); but as I understood it will not work.
Please answer when you implement such possibilities in grid connector, or tell if i will use “MySQL” instead of “PHPYii” data driver, will it obligatory to write ‘config’ in controller?
$config = new GridConfiguration();
$config->setHeader("Username,First Name,Last Name,Email");
$config->setInitWidths('150,150,150,*');
$config->setColTypes("ro,ro,ro,ro");
$grid->set_config($config);
Now I have all settings in view.