DynamicFormWidget e autocomplete

Ciao a tutti sto provando a inserire in un DynamicFormWidget un autocomplete ( sto realizzando un basico form di inserimento fattura per capirci con rapporto 1-n)
il codice che metto è questo

<?php DynamicFormWidget::begin([ 'widgetContainer' => 'dynamicform_wrapper', 'widgetBody' => '.container-items', 'widgetItem' => '.item', 'limit' => 999, 'min' => 1, 'insertButton' => '.add-item', 'deleteButton' => '.remove-item', 'model' => $items[0], 'formId' => 'dynamic-form', 'formFields' => [ 'itcode', 'desciption', 'price' ], ]); ?>
<div class="panel panel-default">
    <div class="panel-heading">
        <h4>
            <i class="glyphicon glyphicon-briefcase"></i> Items
            <button type="button" class="add-item btn btn-success btn-sm pull-right"><i class="glyphicon glyphicon-plus"></i> Add</button>
        </h4>
    </div>
    <div class="panel-body">
        <div class="container-items"><!-- widgetBody -->
            <?php foreach ($items as $i => $m): ?>
                <div class="item"><!-- widgetItem -->
                    <div class="rows">
                        <?php
                        // necessary for update action.
                        if (! $m->isNewRecord) {
                            echo Html::activeHiddenInput($m, "[{$i}]id");
                        }
                        ?>
                        <table width="80%">
                            <tr>
                                <td valign="top" width="5%"><button type="button" class="remove-item btn btn-danger btn-xs"><i class="glyphicon glyphicon-minus"></i></button></td>
                                <td width="25%">
                        <?= $form->field($m, "[{$i}]itcode")->
                               widget(AutoComplete::className(), 
                              ['name' => '[{$i}]itcode',    
			     'id' => "[{$i}]itcode", 
                             'clientOptions' => [
                             'source' => $datam, 
                             'autoFill'=>true,
     'select' => new JsExpression("function( event, ui ) {
    $('#invoice-[{$i}]itcode').val(ui.item.id);
       //#City-state_name is the id of hiddenInput.
 }"),
            'onchange' => new JsExpression("function( event, ui ) {alert((ui.item.label))}")

    ],
 ])->label(false) ?></td>
                                <td width="50%"><?= $form->field($m, "[{$i}]item")->textInput(['maxlength' => true,'placeholder'=>'description'])->label(false) ?></td>
                                <td width="10%"><?= $form->field($m, "[{$i}]qty")->textInput(['maxlength' => true,'placeholder'=>'qta'])->label(false) ?></td>
                                <td width="15%">
                                    <?php echo $form->field($m, "[{$i}]total")->textInput(['placeholder'=>'price'])->label(false);?>
                                </td>
                            </tr>
                        </table>
                    </div><!-- .row -->
                </div>
            <?php endforeach; ?>
        </div>
    </div>
</div><!-- .panel -->
<?php DynamicFormWidget::end(); ?>

il mio problema è il seguente, l’autocomplete funziona solo sulla prima riga, se clicco su add nella seconda riga il campo [{$i}]itcode perde la classe e diventa text.
Qualche suggerimento?
Grazie