EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dtucker on December 27, 2013, 09:16:10 AM



Title: Set value in combox from datagrid
Post by: dtucker on December 27, 2013, 09:16:10 AM
I have a grid and when they select a row it brings up a dialog box with a textbox and a combobox. The data is being sent to the dialog box but the dropdown is not selecting the correct value.

Here's my code:

When they select a row I call a method:
Code:
var row = $('#dgCategory').datagrid('getSelected');
        if (row){
            $('#dlgCategory').dialog('open').dialog('setTitle','Edit Category');
            $('#frmCategory').form('load',row);
            url = 'Category/UpdateCategory.php?orgid='+_selectedOrganization + '&categoryid=' +row.categoryid;
        }

Here's the html code for the dialog box:
Quote
<div id="dlgCategory" class="easyui-dialog"
                        style="width: 300px; height: 180px; padding: 10px 20px"
                        closed="true" buttons="#dlgCategory-buttons">
                        <form id="frmCategory" method="post">
                           <div class="fitem">
                              <input  name="categoryid">
                           </div>
                           <div class="fitem">
                              <input  name="category">
                           </div>
                           <div class="fitem">
                              <label>Category:</label> <input id="cboCategory"
                                 class="easyui-combobox" name="cboCategory"
                                 data-options="valueField:'id',textField:'text',url:'Lookups/Lookup.php?id=56660623-9932-42AD-AF88-8554618B4997', required:'true', panelHeight:'auto'">
                           </div>
                        </form>
                     </div>

Thanks


Title: Re: Set value in combox from datagrid
Post by: stworthy on December 27, 2013, 06:26:00 PM
The data returned from your 'Lookup.php' must be:
[{"id":1,"text":"text1"},{"id":2,"text":"text2"}]

Please confirm if the returned data is correct.


Title: Re: Set value in combox from datagrid
Post by: dtucker on December 29, 2013, 08:23:49 AM
The data being return is xml. The dropdown is populating just not selecting the value when I click a row in the grid to edit it.