EasyUI Forum
December 21, 2025, 07:17:24 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: Add item to combobox  (Read 17122 times)
arma
Full Member
***
Posts: 110


View Profile
« on: June 27, 2014, 10:45:39 PM »

Hi,

How could i add an item/option to combobox?
In grid i could simply add item using mygrid.datagrid('appendRow', data), but i could not find in the jeasyui doc for combobox.

Thanks
« Last Edit: June 27, 2014, 11:59:39 PM by arma » Logged
jarry
Administrator
Hero Member
*****
Posts: 2305


View Profile Email
« Reply #1 on: June 27, 2014, 11:43:23 PM »

You could prepare all the data items and then call 'loadData' method to re-bind the new data.
Code:
var data = $('#cc').combobox('getData');
data.push({id:'idvalue',text:'textvalue'});
$('#cc').combobox('loadData', data);
Logged
arma
Full Member
***
Posts: 110


View Profile
« Reply #2 on: June 28, 2014, 12:00:04 AM »

That's perfect. Thank you.
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!