Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery EasyUI Extension - DWR Loader

jQuery EasyUI Extension - DWR Loader (DWR Loader)


jQuery EasyUI Extensions jQuery EasyUI Extension


Include the 'dwrloader.js' file

To use DWR to fetch data, first include the 'dwrloader.js' file.









Assign the DWR method to the 'url' property

As the default JSON loader, the 'url' property indicates the remote URL from which to fetch JSON data.
When using the DWR loader, we should assign a function to the 'url' property to fetch data from DWR.
The following example demonstrates how to display a datagrid using the DWR loader:



    
    $(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> getDataGridData(){

        List> items = new ArrayList>();

        Map item = new HashMap();

        item.put("id", 1);

        item.put("text", "text1");

        items.add(item);

        item = new HashMap();

        item.put("id", 2);

        item.put("text", "text2");

        items.add(item);

        return items;

    }

}

Download the jQuery EasyUI example

jquery-easyui-dwrloader.zip


jQuery EasyUI Extensions jQuery EasyUI Extension