jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實例
更新時間:2017年09月26日 10:37:05 作者:CharlinGod
這篇文章主要介紹了jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實例的相關(guān)資料,希望通過本文能幫助到大家,讓大家理解掌握這部分內(nèi)容,需要的朋友可以參考下
jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實例
1、創(chuàng)建toolbar:
toolbar:[{ text:'增加', iconCls:'icon-add', handler:function(){ openAddUserDialog(); } }]
2、添加dialog,里面有添加用戶的表單
<div id="addDialog" data-options="closed:true,modal:true,title:'addUser', buttons:[{ text:'保存', iconCls:'icon-add', handler:function(){ //addUser(); $('#addForm').form('submit',{url:'${rootPath}/user_add.action',success:function(data){ var result = JQuery.parseJSON(data); if(result.success){ //$("#datagrid").datagrid('reload'); $("#addDialog").dialog('close'); //把插入的數(shù)據(jù)添加到最后一行 //$("#datagrid").datagrid('appenRow',result.obj); $("#datagrid").datagrid('insertRow',{ index:0; row:result.obj//obj里面存了user對象 }); } $.message.show({ title:'提示', msg:obj.msg }); }}); } }]" class="easyui-dialog"> <table> <tr> <th></th> <tr/> </table> </div>
3、打開對話框:
function openAddUserDialog(){ $(“#addDialog").dialog('open'); }
4、服務(wù)器端返回的json
//返回的json public class Json implements java.io.Serializable { /** * */ private static final long serialVersionUID = 1L; private boolean success = false; private String msg = ""; private Object obj = null; public boolean isSuccess() { return success; } public void setSuccess(boolean success) { this.success = success; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Object getObj() { return obj; } public void setObj(Object obj) { this.obj = obj; } }
如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
相關(guān)文章
在jQuery 1.5中使用deferred對象的代碼(翻譯)
Deferred是jQuery1.5新增的一個特性,很多人把它翻譯成 “異步隊列”,我覺得比較靠譜,畢竟和“延遲”沒啥關(guān)系,不過這篇文章中我還采用deferred這個單詞。2011-03-03jquery 操作兩個select實現(xiàn)值之間的互相傳遞
本篇文章主要是對jquery操作兩個select實現(xiàn)值之間的互相傳遞進行了詳細的介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-03-03jQuery中彈出iframe內(nèi)嵌頁面元素到父頁面并全屏化的實例代碼
這篇文章主要介紹了jQuery中彈出iframe內(nèi)嵌頁面元素到父頁面并全屏化的實例代碼,需要的朋友可以參考下2016-12-12HTML5使用DeviceOrientation實現(xiàn)搖一搖功能
這篇文章主要介紹了HTML5使用DeviceOrientation實現(xiàn)搖一搖功能的相關(guān)資料,需要的朋友可以參考下2015-06-06JQuery調(diào)webservice實現(xiàn)郵箱驗證(檢測是否可用)
JQuery調(diào)webservice實現(xiàn)郵箱驗證:判斷郵箱是否存在如果不存在提示可以使用否從提示該郵箱已存在請重新輸入,感興趣的朋友可以參下哈,希望對你有所幫助2013-05-05