EasyUI Forum

General Category => General Discussion => Topic started by: thiago_brum on April 18, 2016, 12:34:51 PM



Title: Combobox Select Error
Post by: thiago_brum on April 18, 2016, 12:34:51 PM
I have a combobox:

<input id='f1-cod_nat_oper' name='cod_nat_oper' class='easyui-combobox' style='width:300px;' value='' data-options="valueField: 'cod_nat_oper',
                           textField: 'den_nat_oper',
                           url: 'buscar_tabela.php',
                           mode: 'remote',
                           queryParams: {nom_tabela:'nat_operacao',
                                         campo_cod:'cod_nat_oper',
                                         campo_txt:'den_nat_oper' },required:true">

With my PHP load data:

<?php

 $q = $_REQUEST['q'];
 $nom_tabela = $_REQUEST['nom_tabela'];
 $campo_cod = $_REQUEST['campo_cod'];
 $campo_txt = $_REQUEST['campo_txt'];

   $result = array();

 $query = "SELECT $campo_cod,
                  $campo_txt
             FROM $nom_tabela
            WHERE (UPPER($campo_txt) LIKE UPPER('$q%')
               OR TO_CHAR($campo_cod) = '$q')
            ORDER BY $campo_txt ";
 
   $exeTabela = odbc_exec($conecIfx,$query) or die("Error: ".odbc_error()."<br>Query: ".$query);
 
   while($rowTabela = odbc_fetch_array($exeTabela)){
  $rowTabela[$campo_txt] = trim($rowTabela[$campo_cod])." - ".trim($rowTabela[$campo_txt]);
  array_push($result, $rowTabela);
   }

   echo json_encode($result);

?>

If I type a value exactly equal to valueField and select it in the dropbox, it shows the valueField in the combobox, not the textField. How can I fix this?

Ex:
- I type "Venda". I select "1 - Venda Produto" in the dropbox. Combobox text shows "1 - Venda Produto".
- I type "1". I select "1 - Venda Produto" in the dropbox. Combobox text shows "1".


Title: Re: Combobox Select Error
Post by: stworthy on April 18, 2016, 07:34:23 PM
Please try to download the patch file from http://www.jeasyui.com/download/downloads/jquery-easyui-1.4.5-patch.zip.


Title: Re: Combobox Select Error
Post by: thiago_brum on April 19, 2016, 07:22:35 AM
Thanks for help. I tried the patch but now I can't select item in the dropbox.


Title: Re: Combobox Select Error
Post by: thiago_brum on April 27, 2016, 07:08:40 AM
someone help?


Title: Re: Combobox Select Error
Post by: stworthy on April 27, 2016, 06:26:42 PM
Please look at this example http://code.reloado.com/avoxej4/edit#javascript,html. It works fine.