EasyUI Forum
May 17, 2024, 02:58:43 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: Combobox method getValue() does not return value  (Read 29377 times)
arma
Full Member
***
Posts: 110


View Profile
« on: May 05, 2014, 07:23:16 PM »

I populate combobox using method reload() as it requires some dynamic parameter

$('#cc').combobox('reload','some/path/url?&param=xxx');
$('#cc').combobox('getData'); <-- ok, return 2 objects with id and text

I then select a combobox item.

$('#cc').combobox('getText'); <-- ok, return selected text
$('#cc').combobox('getValue); <-- not ok, return empty string

What went wrong? Thanks.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 05, 2014, 07:54:05 PM »

The default value field name of combobox is 'value' not 'id'. So you have to specify the value field name as 'id'.
Code:
$('#cc').combobox({
  valueField: 'id',
  textField: 'text'
});
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #2 on: May 05, 2014, 07:57:22 PM »

Ah yes, i forgot that  Grin thank you stworthy!
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!