EasyUI Forum
May 18, 2024, 05:00:32 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: dosearch + combobox ( How to make it to work ? )  (Read 9464 times)
correohs
Newbie
*
Posts: 11


View Profile
« on: February 06, 2013, 02:33:08 PM »

How to does combobox works with dosearch?

lo_month_sel means  layout month selected
lo_empl_id_sel means layout employee ID selected

Thanks!

function doSearch(){
         $('#dg').datagrid('load',{
            lo_month_sel: $('#lo_month_sel').val(),
            lo_empl_id_sel: $('#lo_empl_id_sel').val()
         });
      }



<? /* --------     this part works great! -------------------------- */        
$curr_month = date("m");
$lo_month_sel = array (0=>"All", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
$select = "<select id=\"lo_month_sel\">\n";
foreach ($lo_month_sel as $key => $val) {
    $select .= "\t<option value=\"".$key."\"";
    if ($key == $curr_month) {
        $select .= " selected=\"selected\">".$val."</option>\n";
    } else {
        $select .= ">".$val."</option>\n";
    }
}
$select .= "</select>";
echo $select;

?>

/* ----------------------------------------------------- This Part Do Not works well for me --------- */
<span>Empl ID:</span>
<?   input id="lo_empl_id_sel" class="easyui-combobox"
        name="lo_empl_id_sel"
      data-options="
               url:'get_empl_dropdown.php',
               valueField:'emp_code',
               textField:'emp_last_name',
               panelHeight:'auto',
                    required:true
         ">
        
        
      <a href="#" class="easyui-linkbutton" plain="true" onClick="doSearch()">Search</a>
« Last Edit: February 07, 2013, 08:48:25 AM by correohs » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 06, 2013, 06:20:42 PM »

To get a combobox value, please use 'getValue' method.

Code:
function doSearch(){
$('#dg').datagrid('load',{
lo_month_sel: $('#lo_month_sel').combobox('getValue'),
lo_empl_id_sel: $('#lo_empl_id_sel').combobox('getValue')
});
}
Logged
correohs
Newbie
*
Posts: 11


View Profile
« Reply #2 on: February 06, 2013, 10:50:24 PM »

stworthy  thank you so much for your reply but it didn't work when I tested it.

This is the Function I had, it works well using input
------------------------------------------------
function doSearch(){
         $('#dg').datagrid('load',{
               lo_empl_id_sel: $('#lo_empl_id_sel').val()
         });
      }

<input id="lo_empl_id_sel" style="line-height:26px;border:1px solid #ccc">  

<a href="#" class="easyui-linkbutton" plain="true" onClick="doSearch()">Search</a>  


-----------------------------------------------------------------------------------------
It work GREAT! Thanks Stworthy
-----------------------------------------------------------------------------------------
function doSearch(){
   $('#dg').datagrid('load',{
      lo_empl_id_sel: $('#lo_empl_id_sel').combobox('getValue')
   });
}


<span>Empl ID:</span>
<?   input id="lo_empl_id_sel" class="easyui-combobox"
        name="lo_empl_id_sel"
      data-options="
               url:'get_empl_dropdown.php',
               valueField:'emp_code',
               textField:'emp_last_name',
               panelHeight:'auto',
               required:true
         ">
      
      
<a href="#" class="easyui-linkbutton" plain="true" onClick="doSearch()">Search</a>
« Last Edit: February 07, 2013, 08:47:28 AM by correohs » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: February 06, 2013, 11:37:20 PM »

Please refer to this example http://jsfiddle.net/dYWVX/. It can get the 'lo_empl_id_sel' value properly.
Logged
correohs
Newbie
*
Posts: 11


View Profile
« Reply #4 on: February 07, 2013, 08:47:59 AM »

it works perfect! Thanks!
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!