How to obtain id of dhtmlxcombo


Hi again, very glad with your support



 



i have this situation:



I have integrated dhtmlxGrid and dhtmlxCombo with autocomplete. The autocomplete comes from the next file, complete.php:



function getDataFromDB($mask){
  $sql = “SELECT distinct item_nm FROM Countries Where item_nm like '”.mysql_real_escape_string($mask)."%’";
  $sql.= " Order By item_nm LIMIT “. $_GET[“pos”].”,20";



  if ( $_GET[“pos”]==0)
   print("");
  else
   print("");
  $res = mysql_query ($sql);
  if($res){
   while($row=mysql_fetch_array($res)){
    print("<option id="".$row[“item_id”]."">");
    print($row[“item_nm”]);
    print("");
   }
  }else{
   echo mysql_errno().": “.mysql_error().” at “.LINE.” line in “.FILE.” file
";
  }
  print("");
 }



 



well, and the ordinary en the html file:



mygrid.setColTypes(“ed,ed,co,dhxCalendar,price,ed,ed[=c4*c5],combo”);



 



So, in this case i have the last column with the dhtmlxcombo with autocomplete…im using an example of the table countries, there are 3 fields: item_id,item_nm,item_cd



It works fine, no errors.



But what happens if i want to save only the id of the selected countrie…



mmmm, i mean:



i write: ‘Aust’… and fast come the Autocomplete with the suggestion: ‘Austria’



well, when im done and press Enter, its suppose is inline editing, but there is a method to get the id of the selected option



because i see in the complete.php that generates an xml with:



print("<option id="".$row[“item_id”]."">");
    print($row[“item_nm”]);
    print("");




so i see $row[“item_id”] putting into an ‘id’ of the option



oohh its so confuse, i hope you understandme, i dont speak english so good


Hello,


Please, use value instead of id:



print("<option value="".$row[“item_id”]."">");



The value of the selected option is the cell value of the grid. So, you can use the following method:



var value = grid.cells(row_id,cell_index).getValue();