EasyUI Forum
May 05, 2024, 01:42:36 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Set combobox value on select  (Read 26153 times)
jmeek01
Newbie
*
Posts: 3


View Profile
« on: September 16, 2015, 12:02:13 PM »

I have been following the examples and issues in the forum.  However, am not able get the selected value from the combobox list to populate the combobox.

<input class="easyui-combobox"
data-options="url: '/api/labapi/patients',
method: 'get',
valueField: 'Id',
textField: 'Display'"
style="width:100%;height:24px">

I don't see how this is any different than the online examples, but it is not selecting the value.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: September 16, 2015, 03:30:53 PM »

Call setValue or getValue methods to set or get the combobox value. Please refer to http://www.jeasyui.com/demo/main/index.php?plugin=ComboBox&theme=default&dir=ltr&pitem=ComboBox%20Actions
Logged
jmeek01
Newbie
*
Posts: 3


View Profile
« Reply #2 on: September 16, 2015, 05:49:09 PM »

I will take a closer look at that sample, but I am looking to have the combobox be populated without external buttons more like this example:

http://www.jeasyui.com/demo/main/index.php?plugin=ComboBox&theme=default&dir=ltr&pitem=ComboBox%20Actions

User should be able to select the dropdown and pick an item from the list to be placed in the combobox.  I thought perhaps I need to specify onSelect event as shown below.  But the online examples seem to work without specifying the onSelect event.

<head>
    <meta charset="UTF-8">

    <link href="~/Content/jeasyui/themes/default/easyui.css" rel="stylesheet"  type="text/css" />
    <link href="~/Content/jeasyui/icon.css" rel="stylesheet"   type="text/css"/>

    <link href="~/Content/myStyle.css" rel="stylesheet"  type="text/css"/>

    <script src="~/Scripts/jeasyui/jquery.min.js"></script>
    <script src="~/Scripts/jeasyui/jquery.easyui.min.js"></script>
   
</head>
<table>
                <tr class="btmPadRow">
                    <td>Id:</td>
                    <td>
                        <input class="easyui-combobox"
                               name="id"
                               data-options="url: '/api/labapi/patients',
                  method: 'get',
                       valueField: 'Value',
                  textField: 'Display',
                                            onSelect: function(record){               
                                            if (record){
                                               $('#id').combobox('setValue',record);
                                             }
                                            }"
                               style="width:100%;height:24px">
                    </td>
                </tr>
</table>
Logged
jmeek01
Newbie
*
Posts: 3


View Profile
« Reply #3 on: September 16, 2015, 06:27:50 PM »

Well I think I may have come across the real issue.  I am developing in ASP .NET MVC and by default is includes jquery-10.2.js, jquery-1.10.2.min.js, and jquery-1.10.2.intellisense.js

Removing the configuration that adds references to the master page header has enabled the jeasyui components to work as expected.

Jason
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!