看了一个最简单的模块,系统管理下的字典分组 主页面是 system/type/typegrouplist.jsp
内容为
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:1px;">
<t:datagrid name="typeGroupList" title="类型分组"
actionUrl="systemController.do?typeGroupGrid" idField="id">
<t:dgCol title="编号" field="id" hidden="false"></t:dgCol>
<t:dgCol title="分组名称" field="typegroupname" width="100"></t:dgCol>
<t:dgCol title="分组编码" field="typegroupcode"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgDelOpt url="systemController.do?delTypeGroup&id={id}" title="删除"></t:dgDelOpt>
<t:dgToolBar title="分组录入11" icon="icon-add"
url="systemController.do?aouTypeGroup" funname="add"></t:dgToolBar>
<t:dgToolBar title="分组编辑" icon="icon-edit"
url="systemController.do?aouTypeGroup" funname="update"></t:dgToolBar>
</t:datagrid>
</div>
</div>
根据标签库对应的类,跟踪进入datagridtag 类发现最后打印的页面是
<script type="text/javascript">
$(function() {
$('#typeGroupList')
.datagrid(
{
idField : 'id',
title : '类型分组',
url : 'systemController.do?typeGroupGrid&field=id,typegroupname,typegroupcode,',
fit : true,
loadMsg : '数据加载中...',
pageSize : 10,
pagination : true,
sortOrder : 'asc',
rownumbers : true,
singleSelect : true,
fitColumns : true,
showFooter : true,
frozenColumns : [ [] ],
columns : [ [
{
field : 'id',
title : '编号',
width : 30,
hidden : true,
sortable : true
},
{
field : 'typegroupname',
title : '分组名称',
width : 100,
sortable : true
},
{
field : 'typegroupcode',
title : '分组编码',
width : 60,
sortable : true
},
{
field : 'opt',
title : '操作',
width : 100,
formatter : function(value, rec, index) {
if (!rec.id) {
return '';
}
var href = '';
href += "[<a href='#' onclick=delObj('systemController.do?delTypeGroup&id="
+ rec.id
+ "','typeGroupList')>";
href += "删除</a>]";
return href;
}
} ] ],
onClickRow : function(rowIndex, rowData) {
rowid = rowData.id;
gridname = 'typeGroupList';
}
});
$('#typeGroupList').datagrid('getPager').pagination({
beforePageText : '',
afterPageText : '/{pages}',
displayMsg : '{from}-{to}共{total}条',
showPageList : true,
pageList : [ 10, 20, 30 ],
showRefresh : true
});
$('#typeGroupList').datagrid('getPager').pagination({
onBeforeRefresh : function(pageNumber, pageSize) {
$(this).pagination('loading');
$(this).pagination('loaded');
}
});
});
function reloadTable() {
$('#' + gridname).datagrid('reload');
}
function reloadtypeGroupList() {
$('#typeGroupList').datagrid('reload');
}
function gettypeGroupListSelected(field) {
return getSelected(field);
}
function getSelected(field) {
var row = $('#' + gridname).datagrid('getSelected');
if (row != null) {
value = row[field];
} else {
value = '';
}
return value;
}
function gettypeGroupListSelections(field) {
var ids = [];
var rows = $('#typeGroupList').datagrid('getSelections');
for ( var i = 0; i < rows.length; i++) {
ids.push(rows[field]);
}
ids.join(',');
return ids
};
function typeGroupListsearch() {
var queryParams = $('#typeGroupList').datagrid('options').queryParams;
$('#typeGroupListtb').find('*').each(function() {
queryParams[$(this).attr('name')] = $(this).val();
});
$('#typeGroupList')
.datagrid(
{
url : 'systemController.do?typeGroupGrid&field=id,typegroupname,typegroupcode,'
});
}
function dosearch(params) {
var jsonparams = $.parseJSON(params);
$('#typeGroupList')
.datagrid(
{
url : 'systemController.do?typeGroupGrid&field=id,typegroupname,typegroupcode,',
queryParams : jsonparams
});
}
function typeGroupListsearchbox(value, name) {
var queryParams = $('#typeGroupList').datagrid('options').queryParams;
queryParams[name] = value;
queryParams.searchfield = name;
$('#typeGroupList').datagrid('reload');
}
$('#typeGroupListsearchbox').searchbox({
searcher : function(value, name) {
typeGroupListsearchbox(value, name);
},
menu : '#typeGroupListmm',
prompt : '请输入查询关键字'
});
function searchReset(name) {
$("#" + name + "tb").find(":input").val("");
typeGroupListsearch();
}
</script>
<table width="100%" id="typeGroupList" toolbar="#typeGroupListtb"></table>
<div id="typeGroupListtb" style="padding:3px; ">
<div style="height:30px;" class="datagrid-toolbar">
<span style="float:left;"><a href="#"
class="easyui-linkbutton" plain="true" icon="icon-add"
>分组录入11</a><a
href="#" class="easyui-linkbutton" plain="true" icon="icon-edit"
>分组编辑</a>
</span>
</div>
</div>
不明白的是onclick="add('分组录入11','systemController.do?aouTypeGroup','typeGroupList')">分组录入11</a> 这个a标签明明调用了add函数,可是页面中没有add函数啊,可是点击时,又把录入页面调出来了,不知道add函数是怎么打印到页面上的,还请大牛告知下
|