欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實(shí)例

 更新時(shí)間:2017年09月26日 10:37:05   作者:CharlinGod  
這篇文章主要介紹了jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實(shí)例的相關(guān)資料,希望通過本文能幫助到大家,讓大家理解掌握這部分內(nèi)容,需要的朋友可以參考下

jQuery 開發(fā)之EasyUI 添加數(shù)據(jù)的實(shí)例

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對(duì)象
        });
      }
      $.message.show({
        title:'提示',
        msg:obj.msg
      });
    }});
  }

}]" class="easyui-dialog">
  <table>
    <tr>
    <th></th>
    <tr/>
  </table>
</div>

3、打開對(duì)話框:

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ǐng)留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

相關(guān)文章

最新評(píng)論