Load value in field select

0

I have a grid with two fields of type easyui-combogrid to select the product by code or by description, I wanted it as soon as the user selected the code to automatically load the description and vice versa, the problem is that when I do the loading via the command below it does not update the field information:

document.getElementsByName('descri[]')[0].value = row.DESCRICAO; 

function setvalores(row) {
    
        document.getElementsByName('cods[]')[0].value = row.CODIGO;
        document.getElementsByName('descri[]')[0].value = row.DESCRICAO;
        
        alert("gravou");
        
    }
<td class="cell">

                                <select id="cods" name="cods[]" class="easyui-combogrid" style="width:150px;"
                                        data-options="
                                        panelWidth: 500,
                                        url: 'get_prods.php?cTipo=1',
                                        idField: 'CODIGO',
                                        textField: 'CODIGO',
                                        mode: 'remote',
                                        fitColumns: true,
                                        columns: [[
                                        {field: 'CODIGO', title: 'Código', width: 60},
                                        {field: 'DESCRICAO', title: 'Descrição', width: 80}
                                        ]],

                                        onSelect: function (index, row) {

                                        setvalores(row);

                                        }
                                        "></select>

                                <input type="hidden" name="apagado[]" value="0"></td>
                            <td class="cell">

                                <select id="descri" name="descri[]" class="easyui-combogrid" style="width:300px;"
                                        data-options="
                                        panelWidth: 500,
                                        url: 'get_prods.php?cTipo=2',
                                        idField: 'CODIGO',
                                        textField: 'DESCRICAO',
                                        mode: 'remote',
                                        fitColumns: true,
                                        columns: [[
                                        {field: 'CODIGO', title: 'Código', width: 60},
                                        {field: 'DESCRICAO', title: 'Descrição', width: 80}
                                        ]],

                                        onSelect: function (index, row) {

                                        setvalores(row);

                                        }
                                        "></select>

                            </td>
    
asked by anonymous 22.10.2018 / 16:52

0 answers