在jqgrid中删除行时显示自定义对话框消息

时间:2014-12-18 11:18:07

标签: javascript php jquery jqgrid

我想在从jqgrid删除行时显示自定义对话框消息。 在从数据库中删除记录之前,我要为每个条件从服务器抛出错误代码。

PHP代码: -

if($request_array['id']==$_SESSION['login_user_id']){
        http_response_code(423);
        exit;
    }
    else if(!sync_user($request_array['id'])){
        http_response_code(410);
        exit;   
    }
    exit;

Javascript代码(jqGrid):

      {
       //Delete
       errorTextFormat: function (response) {
        if(response.status==423){
          return [false, "<?php echo "USER_GRID_DELETE_MESSAGE"; ?>"];
        }
        else if(response.status==410){
            return[false,"<?php echo "USER_SYNC_MESSAGE"; ?>"];
        }
       },
      afterSubmit: function (response, postdata) {
      console.log(response);
       if(response.status==200){
          jQuery.jgrid.info_dialog("<?php echo "GRID_SUCESS_MESSAGE"; ?>","<div class=\"ui-state-highlight\" style=\"padding:5px;\"><?php echo "GRID_RECORD_DELETE_MESSAGE"; ?></div>", 
          jQuery.jgrid.edit.bClose,{buttonalign:"right"});
        return [true,""];
        }
      }

      }

目前我收到的信息如error response "Locked" response code 423

提前致谢。

0 个答案:

没有答案