日期:2014-05-16 浏览次数:20423 次
前段学了小胖的GTGrid,很方便实用。最近在学习Extjs.
做了个CRUD的Demo,包括Extjs版和GTGrid版,做的比较
粗糙,希望对大家有一些帮助。
部分源码:<%@ page language="java" pageEncoding="GBK"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
<title>用户管理首页</title>
<link rel="stylesheet" type="text/css" href="js/ext-2.2/resources/css/ext-all.css" />
<script type="text/javascript" src="js/ext-2.2/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext-2.2/ext-all.js"></script>
<style type="text/css">
.x-panel-body p {
margin:5px;
}
.x-column-layout-ct .x-panel {
margin-bottom:5px;
}
.x-column-layout-ct .x-panel-dd-spacer {
margin-bottom:5px;
}
.settings {
background-image:url(js/ext-2.2/shared/icons/fam/folder_wrench.png) !important;
}
.nav {
background-image:url(js/ext-2.2/shared/icons/fam/folder_go.png) !important;
}
.icon-grid {
background-image: url(js/ext-2.2/shared/icons/fam/grid.png) !important;
}
#button-grid .x-panel-body {
border: 1px solid #99bbe8;
border-top: 0 none;
}
.add {
background-image: url(js/ext-2.2/shared/icons/fam/add.gif) !important;
}
.option {
background-image: url(js/ext-2.2/shared/icons/fam/plugin.gif) !important
;
}
.remove {
background-image: url(js/ext-2.2/shared/icons/fam/delete.gif) !important
;
}
.save {
background-image: url(js/ext-2.2/shared/icons/save.gif) !important;
}
</style>
<script>
<!--
Ext.onReady(function()
{
/**Grid相关**/
Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget='side';
var newFormWin; //form窗口容器
var form1; //添加用户的form
var form2;; //修改用户的form
//侧边栏状态的记录
Ext.state.SessionProvider = Ext.extend(Ext.state.CookieProvider, {
readCookies : function(){
if(this.state){
&n