Good day guys, I have a simple cgridview for my admin page that display all the records. But I want to hide/skip the first record that it will display or start the cgridview with the 2nd record. Thank you in advance.
haha, you see that cgridview consist of medicine records. it was use to fill the list of data of dropdownlist in my form consultation and the first item has value no data the second row will be the first medicine. upon loading the adminpage for medicine i dont want the admin to see the no data row and starts the record with the medicine. sorry for my bad english
This does only works without pagination when you set the dataproviders pagination=false.
The pagination handling of the dataprovider adds always a offset 0, 10, … on fetching data when pagination is set. Even a model or criteria scope with ‘offset’=>1 will not work.
So I can’t see a solution out of the box without using your own dataprovider/pagination overriding the CActiveDataprovider/CPagination.
otherwise you can extend the grid view and during rendering rows make some counter increments by 1 and check whether counter is 1 or not if it is 1 then ignore it
{
// @todo Please modify the following code to remove attributes that should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('med_id',$this->med_id);
$criteria->compare('med_name',$this->med_name,true);
$criteria->compare('med_desc',$this->med_desc,true);
$criteria->compare('med_typeid',$this->med_typeid);
$criteria->compare('med_flag',$this->med_flag);
$criteria->with=array('medType');
$criteria->compare('medType.mtype_name',$this->medType_search, true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
}