I am using the render_sql() method of the gridConnector in a Yii Framework to populate a Grid with a filtered list from a table, using this code:
$grid = new GridConnector($current_model, "PHPYii");
$grid->configure("-", "id", $column_ids);
$sql = "SELECT $column_ids FROM `$table_name` WHERE $sub_filter";
$grid->render_sql($sql,"id",$column_ids);
$column_ids is a comma-separated list of column names.
$sub_filter is in the form “field_name=value”, and is valid.
$current_model is a valid instance of the Model referenced by $table_name.
The SQL statement $sql is valid.
But the grid displays the entire table, instead of a filtered list.
In other contexts, this method is working fine.
I can’t see what I’m doing wrong here…
My table has an auto-increment integer ID field as Primary Key.
One thing I have noticed is that, when using grid->render() the actual ID values (1,2,3, etc) are shown.
When using render_array(), the values shown are different, and are shown in HEX (e.g. 1460390265x0).
The data is saved with the correct auto-increment value.