为什么destroyURL无法与Easyui DataGrid一起使用

时间:2019-03-08 03:58:26

标签: datagrid jquery-easyui

所以在我的项目中,我使用easyui框架。

我想删除表中的选定行,所以我使用edatagrid。

表代码的定义如下:

<div class="table" style="height:100%;width:100%;padding-bottom:50px">
  <table id="storInfoTB" border=1px cellspacing=0 style="width:100%" class="easyui-datagrid" data-options=""></table>
</div>

<script>
 $(function(){
  $("#storInfoTB").edatagrid({
    destroyUrl: "storInfo_destroy.php"
  });
});
$("#storInfoTB").datagrid({
    title: "wawatitle",
    ......   
    columns:[[
      {field:"SNV",title:"numid",width:40},
      .....
    ]],
    toolbar: [{
        id: "delete",   
        text: "delete",
        iconCls: "icon-cut",
        handler: function(){
          $("#storInfoTB").edatagrid("destroyRow"); 
        }           
      }],
    .......
   });
  </script>

storInfo_destroy.php的代码如下:

include("DB.php");
$idnum=$_REQUEST['SNV'];

$sql="delete from  hpc_table  where id='$idnum';"; 
$selR=$conn->query($sql);

现在,我要在单击工具栏中的删除按钮后删除所选行,并在数据库中删除相关数据。

但是它失败了,什么也没做。

我已经测试了何时销毁destroyUrl参数,效果很好。

$("#storInfoTB").edatagrid({
//destroyUrl: "storInfo_destroy.php"
});

但是DB数据仍然存在。

我发现storInfo_destroy.php中的$ id是错误的,值不为

似乎没有什么不对,谁可以帮助我?

0 个答案:

没有答案