Hii In yii framework Cgirdview, I Want to find exact values in cgridview which I given in the cgridview filters.
It means if the filtered results show only 1 result but it is same as exacted which I given in filter.
Thanks in advance:
Here is my code:
Model:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
if(!empty($this->met_not_less)){
$criteria->condition="totmetalwei > :met_not_less";
$criteria->params[':met_not_less']=$this->met_not_less;
}
if(!empty($this->met_not_more)){
$criteria->condition="totmetalwei < :met_not_more ";
$criteria->params[':met_not_more']=$this->met_not_more;
}
$criteria->compare('idsku',$this->idsku);
$criteria->compare('skucode',$this->skucode,true);
$criteria->compare('tdnum',$this->tdnum,true);
$criteria->compare('cdate',$this->cdate,true);
$criteria->compare('mdate',$this->mdate,true);
$criteria->compare('updby',$this->updby);
$criteria->compare('leadtime',$this->leadtime);
$criteria->compare('refpo',$this->refpo);
$criteria->compare('parentsku',$this->parentsku);
$criteria->compare('parentrel',$this->parentrel,true);
$criteria->compare('taxcode',$this->taxcode,true);
$criteria->compare('dimunit',$this->dimunit,true);
$criteria->compare('dimdia',$this->dimdia,true);
$criteria->compare('dimhei',$this->dimhei,true);
$criteria->compare('dimwid',$this->dimwid,true);
$criteria->compare('dimlen',$this->dimlen,true);
$criteria->compare('totmetalwei',$this->totmetalwei,true);
$criteria->compare('metweiunit',$this->metweiunit,true);
$criteria->compare('totstowei',$this->totstowei,true);
$criteria->compare('stoweiunit',$this->stoweiunit,true);
$criteria->compare('numstones',$this->numstones);
$criteria->compare('grosswt',$this->grosswt);
if(!empty($this->type)) $criteria->with[] = 'skucontent';
if(!empty($this->gemstone)) $criteria->with[] = 'stones';
if(!empty($this->gem_shape)) $criteria->with[] = 'shapes';
if(!empty($this->gem_size)) $criteria->with[] = 'sizes';
if(!empty($this->type) || !empty($this->gemstone) || !empty($this->gem_shape) || !empty($this->gem_size)) $criteria->together = true;
if(!empty($this->type)) $criteria->compare( 'skucontent.type', $this->type, true );
if(!empty($this->gemstone)) $criteria->compare('stones.namevar',$this->gemstone, true);
if(!empty($this->gem_shape)) $criteria->compare('shapes.name',$this->gem_shape, true);
if(!empty($this->gem_size)) $criteria->compare('sizes.size',$this->gem_size, true);
if(!empty($this->sku_size)) $criteria->compare( 'skucontent.size', $this->sku_size, true );
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
3835