EasyUI Forum

General Category => Bug Report => Topic started by: iceh on December 26, 2013, 06:28:10 AM



Title: ComboBox setText fails under certain conditions
Post by: iceh on December 26, 2013, 06:28:10 AM
Hi,

i have a combobox in my code. The "setText" method fails
in my prodiction code. I have no idea why :(

It doesn't set the text :(

I tried isolating the issue. Please notice - the combobox sections
are generated by a code generator form my C# code.

bug.html
Code:
	<input id="combobox5" class="easyui-combobox" name="cb5"/>

<script type='text/javascript'>
  $('#combobox5').ready(function () {
    $('#combobox5').combobox({
       width: 200,
   data:
[{ text : 'my text1', id : '1' },
{ text : 'my text2', id : '2' },
{ text : 'my text3', id : '3' }],
   textField: 'text',
   valueField: 'id',
   editable: true

    });
    var __tmpID =  $('#combobox5');
    __tmpID.combobox('setText','my text');
  });
</script>

<br/><br/><br/>

<button id="mybuton">Load CB in Div</button>
<div id="dynamic"></div>


<script type='text/javascript'>
$(document).ready(function () {
$("#mybuton").click(function() {
    $.get("bug-loaded-byajax.html",function(data){
$("#dynamic").html(data);
    });
});
    });
</script>

bug-loaded-byajax.html:

Code:
	<input id="combobox6" class="easyui-combobox" name="cb6"/>
<script type='text/javascript'>
  $('#combobox6').ready(function () {
    $('#combobox6').combobox({
       width: 200,
   data:
[{ text : 'my textX1', id : '1' },
{ text : 'my textX2', id : '2' },
{ text : 'my textX3', id : '3' }],
   textField: 'text',
   valueField: 'id',
   editable: true

    });
    var __tmpID =  $('#combobox6');
    __tmpID.combobox('setText','my text');
  });
</script>


Title: Re: ComboBox setText fails under certain conditions
Post by: stworthy on December 26, 2013, 05:31:45 PM
Please refer to this example http://jsfiddle.net/fwLva/. It works fine.