EasyUI Forum
September 14, 2025, 01:02:14 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: ComboBox setText fails under certain conditions  (Read 11256 times)
iceh
Jr. Member
**
Posts: 61


View Profile
« 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 Sad

It doesn't set the text Sad

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>
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: December 26, 2013, 05:31:45 PM »

Please refer to this example http://jsfiddle.net/fwLva/. It works fine.
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!