框架为struts2
1. jsp页面:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>种类指派</title>
<!-- ExtJS library -->
<link rel="stylesheet" type="text/css" href="css/ext/ext-all.css" />
<script type="text/javascript" src="js/ext/ext-base.js"></script>
<script type="text/javascript" src="js/ext/ext-all.js"></script>
<script type="text/javascript" src="js/ext/edittree/categorychecktree.js"></script>
<script type="text/javascript" src="js/ext/edittree/TreeCheckNodeUI.js"></script>
<script type="text/javascript" src="js/ext/examples.js"></script>
<link href="css/ext/ext-patch.css" type="text/css" rel="stylesheet"/>
<!-- Common Styles for the examples -->
<link rel="stylesheet" type="text/css" href="css/ext/examples.css" />
<style type="text/css">
.complete .x-tree-node-anchor span {
text-decoration: line-through;
color: #777;
}
.x-tree-node .root{
background-image: url(css/images/default/tree/category.png)
}
</style>
</head>
<body style="padding:0 0 0 ;">
<!-- EXAMPLES -->
<div id="tree-div" ></div>
<input type="hidden" id="name" name="name" value='<s:property value="product.name"/>'/>
<input type="hidden" id="productid" name="productid" value='<s:property value="productid"/>'/>
</body>
</html>
2.categorychecktree.js
/*!
* Ext JS Library 3.4.0
* Copyright(c) 2006-2011 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
Ext.onReady(function(){
var tree = new Ext.tree.TreePanel({
renderTo:'tree-div',
// title: document.getElementById('name').value+'——>指派种类',
align:'center',
height: 300,
width: 400,
useArrows:true,
autoScroll:true,
animate:true,
// enableDD:true,拖拽
containerScroll: true,
expanded:true,
rootVisible: false,
checkModel:'single',
onlyLeafCheckable:true,
frame: true,
root: {
nodeType: 'async',
text:'选择类别' ,
iconCls:''
},//loader 引用插件TreeCheckNodeUI,实现单选功能
loader: new Ext.tree.TreeLoader({
dataUrl: 'categorycheckjson.action?productid='+document.getElementById('productid').value,
baseAttrs: { uiProvider: Ext.ux.TreeCheckNodeUI } //添加 uiProvider 属性
}),
buttons: [{
text: '指派种类',
handler: function(){
var categoryId = '', selNodes = tree.getChecked();
var productid=document.getElementById('productid').value;
if(selNodes.length==0){
Ext.Msg.alert('提示','请选择指派种类');
}
Ext.each(selNodes, function(node){
if(categoryId.length > 0){
categoryId += ', ';
}
// msg += node.text;
categoryId += node.attributes['categoryId'];
Ext.MessageBox.confirm("确认","确定指派种类吗?",function(e){
if (e == "yes") {
//提交到服务器操作
Ext.Ajax.request({
url: 'asignCategory.action',
params: {categoryId:categoryId,productid:productid},
method: 'POST',
dataType:'json',
success:function(form,action){
var obj = Ext.util.JSON.decode(form.responseText);
if(obj.success==true)
{
Ext.Msg.alert('指派成功',obj.msg);
var win = parent.Ext.getCmp('win');
if (win) {win.close();}
}
else
{
//Ext.Msg.alert('提示',obj.errors);
Ext.Msg.alert('指派错误',obj.msg);
}
},
//提交失败的回调函数
failure:function(){
Ext.Msg.alert('错误','服务器出现错误请稍后再试!');
}
});
} else if (e == "no") {
// alert("no");
} else if (e == "cancel") {
//alert("cancel");
}});
});
}
},{
text: '关闭',
handler: function(){
var win = parent.Ext.getCmp('win');
// alert(win2);
if (win) {win.close();}
// window.parent.location.href='roleGrid.action'
}
}]
});
tree.getRootNode().expand(true);
tree.root.getUI().getIconEl().src ='';
//'js/ext/icons/fam/book.png';
/////////////////////////
});
其中 json格式:
stcCallback1001({totalCount:"8",results:[{productid:"13",name:"考试",companyName:"教育",create_time:"2012-08-06 16:14:32"},{productid:"12",name:"ggg",companyName:"4546",create_time:"2012-08-06 16:13:29"},{productid:"11",name:"3434",companyName:"3444",create_time:"2012-08-06 16:12:44"},{productid:"10",name:"333",companyName:"fff",create_time:"2012-08-06 16:12:02"},{productid:"9",name:"考试",companyName:"教育",create_time:"2012-08-06 16:10:53"},{productid:"8",name:"999",companyName:"教育",create_time:"2012-08-06 16:09:36"},{productid:"7",name:"考试",companyName:"教育",create_time:"2012-08-06 16:08:20"},{productid:"6",name:"学",companyName:"教育",create_time:"2012-08-06 15:50:26"}]});
- 大小: 17.7 KB
分享到:
相关推荐
分享一个ExtJs Tree, 完整的带有复选框的树形结构
基于EXTjs 的 动态复选框树 json数据交互
extjs相关联的技术也是比较熟悉的, 所以特决定: 把extjs3.4的开发前的准备这篇文章写好以后, 好好研究下4.1版本, 后续会写很多观看的感受和例子实现的文章, 详见后续动作 ; 下面就开始我的ExtJS学习之路吧……
网上搜索了许久未找到...Extjs4.2 带复选框的下拉树,解决了向下勾选子节点、向上勾选父节点,正选反选获取值等问题,勾选的节点显示displayfield值直接显示在下拉文本框中。需要引用ext-all.js和ext-all-neptune.css
extjs带复选框的树包括全选 反选 子选父以及 父选子 与adf在jsp页面得应用 包含了工具类以及针对extjs树节点增加、删除、修改的工具方法
ExtJS3.4(稳定版)源码包,包含所有源码、官方实例及API说明文档。
spket1.6.18和extjs3.4
extjs3.4api,很实用,方便大家学习extjs,欢迎大家下载 extjs3.4中文api,很实用,方便大家学习extjs,欢迎大家下载
Extjs3.4 Ext-core.pdf 轻松搞定Extjs.pdf Extjs学习笔记 里面有3.4的开发包,附属:Ext-core.pdf 轻松搞定Extjs.pdf Extjs学习笔记
extjs4.1下拉复选框完整DEMO,包含了extjs4.1主文件,代码实现了动态加载功能,所以需要配置IIS或者apache。插件文件在ux目录下,请自行参考。
extjs3.2 3.3 3.4都测试过可以使用,带有复选框的树菜单,选中父节点子节点全部选中,选中子节点父节点选中(以及父节点的父节点等),其余版本不知道能否使用
extjsapi,extjs文档,api手岫
extjs 3.4 full package extjs 3.4 ajax 实例
extjs3.4+swfupload整合的上传功能,支持多文件上传
ExtJs4 Checkbox tree
extjs_3.4官方离线API,方便查询所有组件属性
1、解压,进入extjs4.2.1\examples\form,浏览器打开 hbox-form.html 文件,当我勾选中任意一个多选下拉框,然后再勾选‘ALL’时,‘ALL’却是不被选中的状态,且...extjs4.2.1\examples\form\MultipleComboBox.js
1.提供了extjs-3.2及extjs-3.4的离线包 2.提供了spket的eclipse插件包,plugins和features放入eclipse对应的目录中,启动eclipse即可 3.离线包中包含了ext.jsb2文件,可在eclipse的spket中进行相应的配置,方便开发...
具体代码如下所示: Ext.define('AM.view.test.ReceiptList', { extend: 'Ext.grid.Panel', alias: 'widget.receiptlist', id : 'receiptlist', selModel : { selType : 'checkboxmodel', ...