I’m working with a site that works as follows:
There are a few dropdowns that basically fill in blanks for a mysql query. When the ‘search’ button is pressed, the database is queried, it returns an array, I turn it into a CArrayDataProvider and then ajax a CGridView into a div below the dropdowns. Here’s some code to give you a picture:
//Products.php
<?php
$form=$this->beginWidget(
'CActiveForm',
Array(
'id'=>"products-form",
'enableAjaxValidation'=>false
)
);
echo CHtml::dropDownList(
'make',
$productModel->make,
$productModel->makes
);
echo CHtml::dropDownList(
'model',
$productModel->model,
$productModel->models
);
echo CHtml::dropDownList(
'year',
$productModel->year,
$productModel->years
);
?>
<div class='search_button' onclick="ajaxResults();">
<?php $this->endWidget(); ?>
<div id="results-ajax"></div>
//Results.php
$dataProvider = new CArrayDataProvider(
$resultArray,
array(
'keyField'=>false,
'id'=>'parts',
'pagination'=>false
)
);
$columns = Array(...);
$this->widget(
'zii.widgets.grid.CGridView',
array(
'id' => 'results_grid',
'dataProvider'=>$dataProvider,
'selectableRows'=>1,
'selectionChanged'=> "doSomething();",
'columns' => $columns,
'summaryText' => ''
)
);
The problem I’m encountering is that, while the CGridView displays, it doesn’t have any of the javascript-style selectable rows, which I need to be able to use to get further information.
Can someone help me figure this out?
Thanks,
Max