I’m new to web development and I have a Problem sorting
Gridview on a composite form.
and a model M1.
form1 is a custom search form containing textFields and dropDownLists.
and is integrated in form2 trough a call of renderPartial.
On the buttom of form2 is a CGridView. Let’s name it GV.
Controller renders form2 correctly, but when I click on any column
header to sort GV by that column, the whole GV disappears completey.
This I think is a newbie problem and I think some experts can give
me input here quickly, that is why I did not attach any code here.
But If necessary I’ll do that.
Thx a lot.
Clicking on column header makes an ajax call and refreshes (replaces) the current grid with the returned one… by your description it seems that the new grid is not returned thats why the current one is replaced with empty space…
to start you will need to check with "firebug" to see what is called and what is returned…
Thx for your reply.
I’m inspecting request with firebug and have compared it
to request where sorting works. It seems that in my problematical
case request to sort Gridview by column is sent to nowhere because in the
request this parts
are all missing but in the case where sorting request works, they are there!
What does that mean? Any idea?
Once more, thx.
dont know for those X-Wf’s… check what is the URL called and what is returned by that call…
I think the problem is not with GridView itself but with other controls on
the view. this is the situation:
class Voyagesearch extends CFormModel
const TYPE_TEN = 10;
const TYPE_TWENTY = 20;
const TYPE_THIRTY = 30;
const TYPE_FOURTY = 40;
const TYPE_FIFTY = 50;
public function getRadiusOptions()
self::TYPE_TEN => '10',
self::TYPE_TWENTY => '20',
self::TYPE_THIRTY => '30',
self::TYPE_FOURTY => '40',
self::TYPE_FIFTY => '50',
echo $form->dropDownList($model2, 'stationstart_radius', $model2->getRadiusOptions(),
array('prompt' => '','style'=>'float:left; width:50px; margin-top:0.01em; margin-left:10px; ')
public function actionResults()
$model2 = new Voyagesearch;
$model2->startcity_name = $_POST['Voyagesearch']['startcity_name'];
$model2->endcity_name = $_POST['Voyagesearch']['endcity_name'];
$this->render("search_results", array('model'=>$model,'model2' => $model2) )
When I remove these dropdDownList from the view , sorting Gridview by column just
works fine. But when they are there, request for sorting Grid by column fails without
any comment and therefore there is no answer for request and Gridview disappears from view.
Cannot figure out what I’m doing wrong…
PS.: All the other controls on the view get their data from $model2 but the Gridview
gets its data from $model !!
In the code above that you provided the $model is not set… as the grid gets it’s data from $model… how you get the data for it in the controller?
Thx a lot, man!
That was the problem and now every thing just works fine.