i have following code in form but when i come back for update the value is not getting selected.
I have customers name in different table i am mapping them. any idea what i am doing wrong…
echo $form->textField($model,‘cust_name’,array(‘style’=>‘width:220px;’));
$this->widget(‘ext.select2.ESelect2’, array(‘model’=>$model,
'selector' => '#HostCustForm_cust_name',
//'attribute'=>'custDetRel->cust_name',
'options' => array(
'allowClear'=>false,
'placeholder' => 'Search a Customer',
'minimumInputLength' => 3,
'quietMillis'=>100,
'ajax' => array(
'url' => Yii::app()->createUrl('manage/host/customers'),
'dataType' => 'jsonp',
'data' => 'js: function(term,page) {
return {
q: term,
page_limit: 10,
};
}',
'results' => 'js: function(data,page){
return {results: data.details};
}',
),
'formatResult' => 'js:function(data){
return data.name;
}',
'formatSelection' => 'js: function(data) {
return data.name;
}',
),
));