jQuery EasyUI Extension - DWR Loader (DWR Loader)

jQuery EasyUI Extension

Include the 'dwrloader.js' file

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

<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>

Assign DWR method to the 'url' property

As the default JSON loader, the 'url' property represents the remote URL to fetch JSON data from. 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:

<table id="dg"></table>
<script>
    $(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
        });
    });
</script>

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 Example

jquery-easyui-dwrloader.zip

ByteArk Coding Plan

Supports mainstream large models like Doubao, GLM, DeepSeek, Kimi, MiniMax, officially supplied, stable and reliable.

Configuration Guide

Β₯9.9 / Month

Subscribe Now

iFlytek Star Coding Plan

Includes free model call quota, DeepSeek, GLM, Kimi, MiniMax, one-stop experience and deployment platform.

Configuration Guide

Β₯3.9 / Month

Subscribe Now