zoukankan      html  css  js  c++  java
  • easyui 1.2.4 +aspnet mvc常见问题

    1. form提交回调函数无法触发,服务器端返回json被浏览器获取。

    function saveUser() {
    $(
    '#fm').form('submit', {
    url: url,
    onSubmit:
    function () {
    return $(this).form('validate');
    },
    success:
    function (result) {
    var result = eval('(' + result + ')');
    if (result.success) {
    $(
    '#dlg').dialog('close'); // close the dialog
    $('#dg').datagrid('reload'); // reload the user data
    } else {
    $.messager.show({
    title:
    'Error',
    msg: result.msg
    });
    }
    }
    });
    }

    服务器端代码

    public JsonResult AddCustomer(Customer cust)
    {
    string result = "";
    try
    {
    TestEntities data
    = new TestEntities();
    data.AddToCustomers(cust);
    data.SaveChanges();
    result
    = "成功";
    }
    catch (Exception ex)
    {
    result
    = ex.Message;
    }

    return this.Json(new { success = true }, JsonRequestBehavior.AllowGet);
    }

    该Action返回的Json直接被浏览器截获了,而没有触发前端ajax的回调函数。

    解决办法:

    return this.Json(new { success = true },"text/html", JsonRequestBehavior.AllowGet);

     2.  easyui 1.2.4 bug 在一个允许多选的datagrid中删除了选中的某一行记录,并reload datagrid数据之后, 发现该已删除的记录任然存在于getSelections返回的row中,并且是第一行即如果getSelected会发现返回的时已被删除的那条记录。

    解决方法:

    重新加载数据前先清除 Selections

    $('#test').datagrid("clearSelections");
  • 相关阅读:
    Eclipse中项目去除Js验证
    Web安全扫描工具
    Oracle-定时任务
    About_Return
    About_php_封装函数
    About_PHP_函数
    About_PHP_验证码的生成
    About_PHP_文件的上传
    About_MySQL Select--来自copy_03
    About_AJAX_03
  • 原文地址:https://www.cnblogs.com/philzhou/p/2155533.html
Copyright © 2011-2022 走看看