datagrid
easy-UI使用过程中的关于datagrid问题
<table id="dg" class="easyui-datagrid" style="" data-options="fitColumns:true,singleSelect:true,toolbar: '#tb',autoRowHeight:false">
<thead>
<tr>
<th data-options="field:'ck',checkbox:true"></th>
<th data-options="field:'PKID'">PKID</th>
<th data-options="field:'YWDEFID'">业务定义ID</th>
<th data-options="field:'TABLENAME'">表名</th>
<th data-options="field:'FIELDNAME'">字段名</th>
<th data-options="field:'FIELDDESC'">字段描述</th>
<th data-options="field:'FIELDMSG'">提示信息</th>
<th data-options="field:'FIELDGROUP'">分组名</th>
<th data-options="field:'FIELDONLYREAD'">是否只读</th>
<th data-options="field:'ORDERID'">顺序号</th>
<th data-options="field:'TYPEID'">TYPEID</th>
</tr>
</thead>
</table>
$('#dg').datagrid({
url:basePath+"/yw/getList",
queryParams: {
YWDEFID: result.data.ywdefid
}
});
编辑选中行
var row = $('#tt').datagrid('getSelected');
if (row){
alert('Item ID:'+row.itemid+"\nPrice:"+row.listprice);
}
Datagrid分页:
pageSize:10,
pageList:[10,20,30,50]
pagination:true
注意:datagrid会自动向后台传递参数page,rows。又会自动获取total,rows。
在编程时只需要获取即可,不需要再声明之类
分页可以这样认为:分页就是单纯的查某一页的数据,datagrid不会自动识别你传来的数据是多少,要取多少,他只会将后台传来的数据全部展示出来。比如说你在datagrid中设置了pagesize=10 ,但是从后台传来的数据有40条,那么他还是会展示40条。