'dataProvider=>$model->search()

So I have model named "Files".

On the index of the model:


$this->widget('bootstrap.widgets.TbGridView', array(

    'id' => 'translated-grid',

    'dataProvider' => $model->search(),

    'filter' => $model,

.....



Thats working Perfect

Another view :


$model= new Files();

$this->widget('bootstrap.widgets.TbGridView', array(

    'id' => 'translated-grid',

    'dataProvider' => $model->search(),

    'filter' => $model,

.....

This returns 0 result.

Why Guys??

It is working fine for all the other Models, So my question is where is the place to look for a mistake? Anyone have an idea why this would happen?

Ps : when I tried $model->count() , works fine too.

The problem only with the method search(). (BUT the confusing part is i can have the perfect result on index of the model)

check how it is done in index action:

[list=1]

[*]you create model instance (preferably with ‘search’ scenario): $model = new Files(‘search’);

[*]then you clean up all default values so that they won’t be used as filter in search(): $model->unsetAttributes();

[*]then you may call $model->search() to get dataprovider…

[/list]