EasyUI Forum
September 19, 2025, 05:09:09 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: Load data object in grid, Nice! But how in combogrid?  (Read 11576 times)
Ellipsis
Full Member
***
Posts: 113


View Profile WWW
« on: January 20, 2013, 10:02:21 AM »

Is it possible to Load a preloaded/generated data object in a combogrid and select the first available?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 20, 2013, 07:11:29 PM »

Please refer to the following code:
Code:
	<select class="easyui-combogrid" style="width:250px" data-options="
panelWidth: 500,
idField: 'itemid',
textField: 'productname',
data: [
{itemid:'item1',productname:'name1'},
{itemid:'item2',productname:'name2'},
{itemid:'item3',productname:'name3'}
],
onLoadSuccess:function(data){
if (data.rows.length){
$(this).combogrid('setValue',data.rows[0].itemid);
}
},
columns: [[
{field:'itemid',title:'Item ID',width:80},
{field:'productname',title:'Product',width:120}
]],
fitColumns: true
">
</select>
Logged
Ellipsis
Full Member
***
Posts: 113


View Profile WWW
« Reply #2 on: January 21, 2013, 02:29:57 AM »

Thank you, I was making It too complex. (Figured I had to get the datagrid object first)

Sometimes I combine the use of loading a data object and using the url Ajax load.

The onLoadSuccess seems tricky though, this means the data is loaded but is the combogrid always available then?
Sometimes It seems That large data objects cause a certain delay between loadready And grid rendered (And available)
« Last Edit: January 21, 2013, 05:58:48 AM by Ellipsis » 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!