Dependent drop down lists with yii2 dynamic forms

I’m using wbraganca for the dynamic form where is my drop down lists, but i have a issue:
it works with only one item, but if i add another item, the second one change the dependent of that dropDownList.

Here is my form:
<?= $form->field($modelDetallecompra, “[{$i}]ID_ARTICULO”)->dropDownList(
‘prompt’=>‘Seleccionar artículo’,
‘$.get( "’.Url::toRoute(’/detallearticulo/list’).’", { id: $(this).val() })
.done(function( data ) { $( “#’.Html::getInputId($modelDetallecompra, “[{$i}]ID_DETALLE_ARTICULO”).’” ).html( data ); } );’

                    <div class="row">
                        <div class="col-sm-6">
                    <?= $form->field($modelDetallecompra, "[{$i}]ID_DETALLE_ARTICULO")->dropDownList(
                        ['style'=>'width:500px', 'prompt'=>'Seleccionar detalle']
                    ) ?>

And here is the controller:

public function actionList($id)
    $detalles = Detallearticulo::find()

    if(isset($detalles) && count($detalles)>0) {
        foreach($detalles as $result) {
            echo "<option value='",$result->ID_DETALLE_ARTICULO."'>".$result->CANTIDAD_ARTICULO."</option>";
        }else {
            echo "<option> No se ha asignado un detalle para este artículo </option>";