EasyJWeb的Ajax綜合示例應用于1月10號上線,這是團隊2008年第一次源代碼發布。該示例包括ExtJS集成、遠程腳本調、Ajax表單提交等多種實例,基于EJS構架開發,持久層使用JPA及泛型DAO、業務邏輯層使用Spring2進行Bean的管理,表示層使用EasyJWeb的MVC及ExtJS等實現,示例演示了一般應用開發中的幾種Ajax應用方式,歡迎大家下載交流。
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: '地區信息',
draggable:false,
id:'root'
});
tree.setRootNode(root);
tree.render();
root.expand();
});

示例截圖:

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

(一個異步加載的樹)

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

(產品編輯)