当前位置: 代码迷 >> Java Web开发 >> easyui datagrid 中怎么添加事件
  详细解决方案

easyui datagrid 中怎么添加事件

热度:395   发布时间:2016-04-16 21:44:52.0
easyui datagrid 中如何添加事件
代码如下:我知道如果用js创建的话可以加事件,但现在是用table来创建,如何加
<div id="kk" class="easyui-layout">
<table class="easyui-datagrid" title="Basic DataGrid"  
data-options="singleSelect:true,
        collapsible:true,
        pagination: true,
        pageSize:5,
        rownumbers: true,
        url:'../ashx/test.ashx?reco=12',
        pageList:[5,10,20,30,40],                    
        method:'get'">
<thead>
<tr>
<th data-options="field:'NEW_TITLE',width:380">Item ID</th>
<th data-options="field:'NEW_ID',width:100">Product</th>
<th data-options="field:'NEW_WRITER',width:250">Attribute</th>
<th data-options="field:'NEW_SENDTIME',width:160,align:'center'">Status</th>
</tr>
</thead>
</table>
还有就是为什么我的分页不起作用,都是将所有数据显示出来,难道easyui的pagination是骗人的???
------解决思路----------------------
使用html元素创建的datagrid也可以用js添加事件的
建议楼主再看看demo

分页不起作用查看自己的数据格式是否是对应的格式
{"total":28,"rows":[
{"productid":"FI-SW-01","productname":"Koi","unitcost":10.00,"status":"P","listprice":36.50,"attr1":"Large","itemid":"EST-1"},
{"productid":"K9-DL-01","productname":"Dalmation","unitcost":12.00,"status":"P","listprice":18.50,"attr1":"Spotted Adult Female","itemid":"EST-10"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":38.50,"attr1":"Venomless","itemid":"EST-11"},
{"productid":"RP-SN-01","productname":"Rattlesnake","unitcost":12.00,"status":"P","listprice":26.50,"attr1":"Rattleless","itemid":"EST-12"},
{"productid":"RP-LI-02","productname":"Iguana","unitcost":12.00,"status":"P","listprice":35.50,"attr1":"Green Adult","itemid":"EST-13"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":158.50,"attr1":"Tailless","itemid":"EST-14"},
{"productid":"FL-DSH-01","productname":"Manx","unitcost":12.00,"status":"P","listprice":83.50,"attr1":"With tail","itemid":"EST-15"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":23.50,"attr1":"Adult Female","itemid":"EST-16"},
{"productid":"FL-DLH-02","productname":"Persian","unitcost":12.00,"status":"P","listprice":89.50,"attr1":"Adult Male","itemid":"EST-17"},
{"productid":"AV-CB-01","productname":"Amazon Parrot","unitcost":92.00,"status":"P","listprice":63.50,"attr1":"Adult Male","itemid":"EST-18"}
]}

------解决思路----------------------
分页是后台分页,你启用了pagination,要接收他的分页参数,有当前页和每页显示多少条两个参数,然后根据这两个参数去后台分页,
添加事件先获取这个表格,然后用JS添加,demo很文档中都有,楼主还是再仔细看看把
------解决思路----------------------
引用:
Quote: 引用:

分页是后台分页,你启用了pagination,要接收他的分页参数,有当前页和每页显示多少条两个参数,然后根据这两个参数去后台分页,
添加事件先获取这个表格,然后用JS添加,demo很文档中都有,楼主还是再仔细看看把


是不是easyui只能是后台分页,而没有本地分页吗??难怪我的数据全部显示,但按分页没有用


不是一次将全部数据查出来,而是根据你所选的页数传到后台进行查询
  相关解决方案