EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Ellipsis on January 20, 2013, 10:02:21 AM



Title: Load data object in grid, Nice! But how in combogrid?
Post by: Ellipsis 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?


Title: Re: Load data object in grid, Nice! But how in combogrid?
Post by: stworthy 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>


Title: Re: Load data object in grid, Nice! But how in combogrid?
Post by: Ellipsis 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)