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(
ArrayHelper::map(Articulo::find()->all(),‘ID_ARTICULO’,‘CODIGO_ARTICULO’,‘NOMBRE_ARTICULO’),
[
‘style’=>‘width:500px’,
‘prompt’=>‘Seleccionar artículo’,
‘onchange’=>
/’$.post(“index.php?r=detallearticulo/list&id=’.’”+$(this).val(),
function(data){$(“select#ID_DETALLE_ARTICULO”).html(data);
});’
/
‘$.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(
                        ArrayHelper::map(Detallearticulo::find()->all(),'ID_DETALLE_ARTICULO','CANTIDAD_ARTICULO'),
                        ['style'=>'width:500px', 'prompt'=>'Seleccionar detalle']
                    ) ?>

And here is the controller:

public function actionList($id)
{
    $detalles = Detallearticulo::find()
    ->where(['ID_ARTICULO'=>$id])
    ->all();

    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>";
    }
}