Нужна помощь в DepDrop

Доброго времени суток. Помогите разобраться. Поставил DopDrop demos.krajee.com/widget-details/depdrop по третьему сценарию. Но не могу заставить второе и третье поле загружать данные из бд. Постоянно висит надпись Загрузка…

И почему то второе поле стоит активным, его нужно сделать не активным как и третье. скрины ниже.

_form.php:

<?php

use app\modules\brand\models\AccBrand;

use app\modules\device_type\models\AccDeviceType;

use app\modules\model_of_device\models\AccModelOfDevice;

use yii\helpers\ArrayHelper;

use yii\helpers\Html;

use kartik\form\ActiveForm;

use kartik\widgets\DepDrop;

use yii\helpers\Url;

/* @var $this yii\web\View */

/* @var $model app\modules\service\models\AccService */

/* @var $form yii\widgets\ActiveForm */

?>

<?php

if (&#036;model-&gt;isNewRecord) {


    ?&gt;





    &lt;?= &#036;form-&gt;field(&#036;model, 'brand')-&gt;widget(DepDrop::classname(), [


        'id'=&gt;'brand-id',


        'data'=&gt; ArrayHelper::map(AccBrand::find()-&gt;


        asArray()-&gt;


        all(), 'id', 'brand_name'),


        'options' =&gt; [


                'placeholder' =&gt; 'Select ...'/*,


            'multiple' =&gt; true*/


        ],


        'type' =&gt; DepDrop::TYPE_SELECT2,


        'select2Options'=&gt;['pluginOptions'=&gt;['allowClear'=&gt;true]],


        'pluginOptions'=&gt;[


            'depends'=&gt;['brand-id'],


            'url' =&gt; Url::to(['/service/child-brand']),


            'loadingText' =&gt; 'Загрузка...',


        ]


    ]);


    ?&gt;


    &lt;?= &#036;form-&gt;field(&#036;model, 'device_type')-&gt;widget(DepDrop::classname(), [


        'data'=&gt; ArrayHelper::map(AccDeviceType::find()-&gt;


        asArray()-&gt;


        all(), 'id', 'device_type'),


        'options' =&gt; ['placeholder' =&gt; 'Select ...'],


        'type' =&gt; DepDrop::TYPE_SELECT2,


        'select2Options'=&gt;['pluginOptions'=&gt;['allowClear'=&gt;true]],


        'pluginOptions'=&gt;[


            'depends'=&gt;['accservice-brand'],


            'url' =&gt; Url::to(['/service/child-account']),


            'loadingText' =&gt; 'Загрузка...',


        ]


    ]);


    ?&gt;





   &#60;&#33;-- --&#62;&lt;?php

/* $brand = $this->brand;

    &#036;device_type = &#036;this-&gt;device_type;


    */?&gt;





    &lt;?= &#036;form-&gt;field(&#036;model, 'model')-&gt;widget(DepDrop::classname(), [


        'data'=&gt; ArrayHelper::map(AccModelOfDevice::find()-&gt;


        where('id_brand_name = :id_brand_name', [':id_brand_name' =&gt; &#036;brand])-&gt;


        andWhere('id_device_type = :id_device_type', [':id_device_type' =&gt; &#036;device_type])-&gt;


        asArray()-&gt;


        all(), 'id', 'model_name'),


        'options' =&gt; ['placeholder' =&gt; 'Select ...'],


        'type' =&gt; DepDrop::TYPE_SELECT2,


        'select2Options'=&gt;['pluginOptions'=&gt;['allowClear'=&gt;true]],


        'pluginOptions'=&gt;[


            'depends'=&gt;['accservice-device_type'],


            'url' =&gt; Url::to(['/service/child-account']),


            'loadingText' =&gt; 'Загрузка...',


        ]


    ]);


    ?&gt;





    &lt;?php


}


    ?&gt;

DefaultController.php:

<?php

namespace app\modules\service\controllers;

use app\modules\brand\models\AccBrand;

use app\modules\device_type\models\AccDeviceType;

use app\modules\model_of_device\models\AccModelOfDevice;

use Yii;

use app\modules\service\models\AccService;

use app\modules\service\models\AccServiceSearch;

use yii\helpers\Json;

use yii\web\Controller;

use yii\web\NotFoundHttpException;

use yii\filters\VerbFilter;

/**

  • DefaultController implements the CRUD actions for AccService model.

*/

class DefaultController extends Controller

{

/**


 * @inheritdoc


 */


public function behaviors()


{


    return [


        'verbs' =&gt; [


            'class' =&gt; VerbFilter::className(),


            'actions' =&gt; [


                'delete' =&gt; ['POST'],


            ],


        ],


    ];


}





/**


 * Lists all AccService models.


 * @return mixed


 */


public function actionIndex()


{


    &#036;searchModel = new AccServiceSearch();


    &#036;dataProvider = &#036;searchModel-&gt;search(Yii::&#036;app-&gt;request-&gt;queryParams);





    return &#036;this-&gt;render('index', [


        'searchModel' =&gt; &#036;searchModel,


        'dataProvider' =&gt; &#036;dataProvider,


    ]);


}








/**


 * Displays a single AccService model.


 * @param integer &#036;id


 * @return mixed


 */


public function actionView(&#036;id)


{


    return &#036;this-&gt;render('view', [


        'model' =&gt; &#036;this-&gt;findModel(&#036;id),


    ]);


}





/**


 * Creates a new AccService model.


 * If creation is successful, the browser will be redirected to the 'view' page.


 * @return mixed


 */





public function actionCreate()


{


    &#036;model = new AccService();





    if (&#036;model-&gt;load(Yii::&#036;app-&gt;request-&gt;post()) &amp;&amp; &#036;model-&gt;save()) {


        return &#036;this-&gt;redirect(['update', 'id' =&gt; &#036;model-&gt;id]);


    } else {


        return &#036;this-&gt;render('create', [


            'model' =&gt; &#036;model,


        ]);


    }


}





public function actionChildBrand() {


    &#036;out = [];


    if (isset(&#036;_POST['depdrop_parents'])) {


        &#036;id = end(&#036;_POST['depdrop_parents']);


        &#036;list = AccDeviceType::find()-&gt;asArray()-&gt;all();


        &#036;selected  = null;


        if (&#036;id &#33;= null &amp;&amp; count(&#036;list) &gt; 0) {


            &#036;selected = '';


            foreach (&#036;list as &#036;i =&gt; &#036;model) {


                &#036;out[] = ['id' =&gt; &#036;model['id'], 'name' =&gt; &#036;model['device_type']];


                if (&#036;i == 0) {


                    &#036;selected = &#036;model['id'];


                }


            }


            // Shows how you can preselect a value


            echo Json::encode(['output' =&gt; &#036;out, 'selected'=&gt;&#036;selected]);


            return;


        }


    }


    echo Json::encode(['output' =&gt; '', 'selected'=&gt;'']);


}





public function actionChildAccount() {


    &#036;out = [];


    if (isset(&#036;_POST['depdrop_parents'])) {


        &#036;id = end(&#036;_POST['depdrop_parents']);


        &#036;list = AccModelOfDevice::find()-&gt;


        andWhere(['id_brand_name'=&gt;&#036;brand])-&gt;


        andWhere(['id_device_type'=&gt;&#036;device_type])-&gt;


        asArray()-&gt;all();


        &#036;selected  = null;


        if (&#036;id &#33;= null &amp;&amp; count(&#036;list) &gt; 0) {


            &#036;selected = '';


            foreach (&#036;list as &#036;i =&gt; &#036;account) {


                &#036;out[] = ['id' =&gt; &#036;account['id'], 'name' =&gt; &#036;account['name']];


                if (&#036;i == 0) {


                    &#036;selected = &#036;account['id'];


                }


            }


            // Shows how you can preselect a value


            echo Json::encode(['output' =&gt; &#036;out, 'selected'=&gt;&#036;selected]);


            return;


        }


    }


    echo Json::encode(['output' =&gt; '', 'selected'=&gt;'']);


}





/**


 * Updates an existing AccService model.


 * If update is successful, the browser will be redirected to the 'view' page.


 * @param integer &#036;id


 * @return mixed


 */


public function actionUpdate(&#036;id)


{


    &#036;model = &#036;this-&gt;findModel(&#036;id);





    if (&#036;model-&gt;load(Yii::&#036;app-&gt;request-&gt;post()) &amp;&amp; &#036;model-&gt;save()) {


        return &#036;this-&gt;redirect(['view', 'id' =&gt; &#036;model-&gt;id]);


    } else {


        return &#036;this-&gt;render('update', [


            'model' =&gt; &#036;model,


        ]);


    }


}





/**


 * Deletes an existing AccService model.


 * If deletion is successful, the browser will be redirected to the 'index' page.


 * @param integer &#036;id


 * @return mixed


 */


public function actionDelete(&#036;id)


{


    &#036;this-&gt;findModel(&#036;id)-&gt;delete();





    return &#036;this-&gt;redirect(['index']);


}





/**


 * Finds the AccService model based on its primary key value.


 * If the model is not found, a 404 HTTP exception will be thrown.


 * @param integer &#036;id


 * @return AccService the loaded model


 * @throws NotFoundHttpException if the model cannot be found


 */


protected function findModel(&#036;id)


{


    if ((&#036;model = AccService::findOne(&#036;id)) &#33;== null) {


        return &#036;model;


    } else {


        throw new NotFoundHttpException('The requested page does not exist.');


    }


}

}

таблицы

CREATE TABLE acc_brand (

id int(11) NOT NULL AUTO_INCREMENT,

brand_name varchar(50) NOT NULL COMMENT ‘Бренд’,

authorization int(1) DEFAULT NULL COMMENT ‘Гарантийный ремонт от производителя’,

logo_img varchar(55) DEFAULT NULL COMMENT ‘Путьк картинке логотипа’,

PRIMARY KEY (id)

) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 AVG_ROW_LENGTH=4096 ROW_FORMAT=DYNAMIC

CREATE TABLE acc_device_type (

id int(11) NOT NULL AUTO_INCREMENT,

device_type varchar(50) NOT NULL COMMENT ‘Тип аппарата’,

PRIMARY KEY (id)

) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8 AVG_ROW_LENGTH=3276 ROW_FORMAT=DYNAMIC COMMENT=‘Тип аппарата’

CREATE TABLE acc_model_of_device (

id int(11) NOT NULL AUTO_INCREMENT,

model_name varchar(250) NOT NULL,

id_brand_name int(11) NOT NULL,

id_device_type int(11) NOT NULL,

model_img varchar(50) NOT NULL,

PRIMARY KEY (id),

KEY model_brand__fk (id_brand_name),

KEY model_device_type_id_fk (id_device_type),

CONSTRAINT model_brand__fk FOREIGN KEY (id_brand_name) REFERENCES acc_brand (id),

CONSTRAINT model_device_type_id_fk FOREIGN KEY (id_device_type) REFERENCES acc_device_type (id)

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=cp1251