jQuery EasyUI extension - DWR loader
It contains 'dwrloader.js' file
Use DWR to obtain the data, the first to include 'dwrloader.js' files.
<Script type = "text / javascript" src = "http://code.jquery.com/jquery-1.7.2.min.js"> </ script> <Script type = "text / javascript" src = "http://www.w3cschool.cc/try/jeasyui/jquery.easyui.min.js"> </ script> <Script type = "text / javascript" src = "dwrloader.js"> </ script>
The DWR method assigned to the 'url' property
Json as the default loader, 'url' attribute indicates the remote URL json to get data.
When using DWR loader, we should assign a function to the 'url' property to get the data from DWR.
The following example demonstrates how to use DWR loader to display the data grid (datagrid):
<Table id = "dg"> </ table> $ (Function () { $ ( '# Dg'). Datagrid ({ columns: [[ {Field: "id", title: 'ID', width: 80}, {Field: "text", title: 'Text', width: 100} ]], singleSelect: true, autoRowHeight: false, width: 200, height: 200, url: MyTest.getDataGridData }); });
Java test code
public class Test { public List <Map <String, Object >> getDataGridData () { List <Map <String, Object >> items = new ArrayList <Map <String, Object >> (); Map <String, Object> item = new HashMap <String, Object> (); item.put ( "id", 1); item.put ( "text", "text1"); items.add (item); item = new HashMap <String, Object> (); item.put ( "id", 2); item.put ( "text", "text2"); items.add (item); return items; } }
Download jQuery EasyUI examples
jQuery EasyUI Extended