jQuery EasyUI DataGrid combogrid editor
HTML
<h2>Datagrid with Combogrid editor get remote data</h2>
<p>Test loading remote data for easyui</p>
<div class="easyui-panel" style="width:100%; height:400px; padding:12px;">
<table id="dg"></table>
</div>
CSS
</style>
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css">
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.edatagrid.js"></script>
<script type="text/javascript" src="http://www.jeasyui.com/easyui/datagrid-scrollview.js"></script>
<style>
JavaScript
$(function(){
var dg = $('#dg').edatagrid();
dg.edatagrid({
title:"edatagrid with combogrid editor",
fit:true, pagination: true, singleSelect:true, striped:true, rownumbers: true, fitColumns: true,
data:gridData,
columns:[[
{field:'server', title:'servername', width:200,
formatter:function(value,row){
return row.serverName || value;
},
editor:{
type:'combogrid',
options:{
rownumbers: true,
singleSelect:true,
autoRowHeight:false,
panelHeight: 160,
view:scrollview,
pageSize: 5,
idField:'value',
textField:'text',
mode: 'remote',
url: '/echo/json/',
columns:[[
{field:'text', title:'Servername', width: 250}
]],
onBeforeLoad: function(param) {
console.log('onBeforeLoad combogrid datagrid ...');
param.delay = 2; //simulate a small delay
//add result data for jsfidle echo jason
param.json = JSON.stringify(data);
},
loadFilter: function(data){
console.log('on loadFilter...');
if ($.isArray(data)){
data = {
total:data.length,
rows:data
};
}
return data;
},
onFetch: function(page, rows){
console.log('onFetch page: ' + page);
},
onShowPanel: function() {
console.log('onShowPanel ...');
}
}
}
},
...