my english is very bad,
I want to coding DepDrop in unclead?
Who can do, Please help
Thanks
/////////////////////
_form.php
////////////////////
<div class="row">
<?= $form->field($model, 'cate_Items')->label(false)->widget(MultipleInput::className(),[
//'limit' => 10,// สูงสุด 10 รายการ
'allowEmptyList' => false,
'min' => 1,//อย่างน้อยมี 1 รายการ
'rowOptions' =>[],
'columns' => [
[
'name' => 'id',
'title' => 'id ',
'enableError' => true,
'type' => MultipleInputColumn::TYPE_HIDDEN_INPUT,
],
[
'name' => 'Content',
'title' => 'Type Content',
'type' => MultipleInputColumn::TYPE_DROPDOWN,
'value' => function($data){
return $data['CropID'];
},
'items' => RefCode::getListCategory(),
'enableError' => true,
'options' => [
'class' => 'new_class' ,
'id' => 'ddl-Content',
'prompt' => 'Product type',
]
],
[
'name' => 'category',
'title' => 'Category',
//'type' => \yii\widgets\MaskedInput::className(), ,
'type' => DepDrop::classname(),
'value' => function($data){
return $data['category'];
},
//'items' => [],
'options' => ['id'=>'ddl-Category',
'data' => [ $model->cate_Items['category']],
'pluginOptions'=>[
'depends'=>['ddl-Content'],
'placeholder'=> 'Category...',
'url'=>Url::to(['/client/get-category'])
]
],
'enableError' => true,
],
]
])?>
</div>
//////////////////////////////
ClientController.php
////////////////////////////////////
public function actionGetCategory() {
$out = [];
if (isset($_POST['depdrop_parents'])) {
$parents = $_POST['depdrop_parents'];
if ($parents != null) {
$content = $parents[0];
$out = $this->GetCateList($content);
echo Json::encode(['output'=>$out, 'selected'=>'']);
return;
}
}
echo Json::encode(['output'=>'', 'selected'=>'']);
}
protected function GetCateList($content){
//if (($model = Category::findOne(['content' => $content, 'cate_type' => $cate_type])) !== null) {
$datas = Category::find()->where(['content'=>$content])->all();
return $this->MapData($datas,'cate_type','explan_eng');
}