EasyUI Forum
September 14, 2025, 03:33:07 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: combotree initial value inside form  (Read 11984 times)
crosemffet
Jr. Member
**
Posts: 68



View Profile WWW Email
« on: December 13, 2012, 03:31:32 PM »

I have one combotree inside a form.
the combotree is populated with ajax request.
the problem is the initial value shows the row id, not the row text.
once expanded, it's fixed.
what's wrong?
here's the code:
<form id="mainForm2" name="mainForm2" method="post">
<select id="agent" name="agent" class="easyui-combotree" data-options="url:'myurl.php',required:true,animated:false" style="width:670px;" />
</form>
then:
$('#mainForm2').form('load', jQuery.parseJSON(response));
response is: {"agent":"2289"}
combrotree values is agent's name, i.e. 2289-john, 2290-mike
combotree shows 2280, instead john.
any idea...?
thanks you in advance,
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: December 13, 2012, 06:38:24 PM »

When you load combotree in the form with only 'id' value, this 'id' value will display on the combotree since the 'text' value can not be retrieved yet. To display desired text value, you need to prepare the 'id' and 'text' values together and call 'setText' method to set 'text' value for combotree.

Code:
var data = jQuery.parseJSON(response);
$('#mainForm2').form('load', data);
$('#agent').combotree('setText', data.agentName);  // the agentName field value need to be prepared
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!