EasyJWeb的Ajax綜合示例應(yīng)用于1月10號上線,這是團(tuán)隊2008年第一次源代碼發(fā)布。該示例包括ExtJS集成、遠(yuǎn)程腳本調(diào)、Ajax表單提交等多種實例,基于EJS構(gòu)架開發(fā),持久層使用JPA及泛型DAO、業(yè)務(wù)邏輯層使用Spring2進(jìn)行Bean的管理,表示層使用EasyJWeb的MVC及ExtJS等實現(xiàn),示例演示了一般應(yīng)用開發(fā)中的幾種Ajax應(yīng)用方式,歡迎大家下載交流。
Ajax綜合示例在線演示:http://easyjweb.demo.easyjf.com/ajax2/
Ajax綜合示例War包及源碼:ftp://ftp1.easyjf.com/easyjweb/demo/ajax2.war (13M)
Ajax綜合示例的源碼:ftp://ftp1.easyjf.com/easyjweb/demo/ajax2-src.zip (665K)
代碼摘要:
Ext.BLANK_IMAGE_URL = 'plugins/extjs/ext-2.0/resources/images/default/s.gif';

Ext.onReady(function()...{

var tree = new Ext.tree.TreePanel(...{
el:"tree-div",
autoScroll:true,
animate:true,
width:'100px',
height:'300px',
enableDD:true,
containerScroll: true,

loader: new Ext.tree.TreeLoader(...{
dataUrl:'region.ejf?cmd=getRegion'
})
});

tree.on("click",function(node,event)...{alert(node.id);});

tree.on('beforeload',function(node)...{
tree.loader.dataUrl = 'region.ejf?cmd=getRegion&id='+(node.id!='root'?node.id:"");
});

var root = new Ext.tree.AsyncTreeNode(...{
text: '地區(qū)信息',
draggable:false,
id:'root'
});
tree.setRootNode(root);
tree.render();
root.expand();
});

示例截圖:

(基于ExtJS的客戶檔案管理)

(一個異步加載的樹)

(傳統(tǒng)Ajax的客戶檔案管理)

(產(chǎn)品編輯)