删除时Kendo ui弹出网格未在php文件中获取数据

删除时Kendo ui弹出网格未在php文件中获取数据,php,parameters,return-value,json,kendo-ui,Php,Parameters,Return Value,Json,Kendo Ui,我对kendoui弹出式网格编辑有问题。当我从grid parameterMap中删除任何行时,不会将ny值返回到php文件 我的index.php代码是 <!DOCTYPE html> <html> <head> <title>CRUD Using Kendo</title> <script src="http://code.jquery.com/j

我对kendoui弹出式网格编辑有问题。当我从grid parameterMap中删除任何行时,不会将ny值返回到php文件

我的index.php代码是

     <!DOCTYPE html> 
    <html> 
        <head> 
        <title>CRUD Using Kendo</title>

           <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://cdn.kendostatic.com/2012.1.515/js/kendo.all.min.js"></script>
<link href="http://cdn.kendostatic.com/2012.1.515/styles/kendo.common.min.css" rel="stylesheet" />
<link href="http://cdn.kendostatic.com/2012.1.515/styles/kendo.default.min.css" rel="stylesheet" />

        </head>



<body> 

    <div id="grid"></div> 
     <script type="text/x-kendo-template" id="productsEditTemplate">            
            <form action="employee.php" method="post">
            <label for="price">firstname</label><input data-bind="value: FirstName" name="FirstName"/><br/>
            <label for="discounted">LastName</label><input data-bind="value: LastName" name="LastName"/><br/>
            <input type="hidden" name="pk_id" data-bind="value: pk_id" />           
            <input type="hidden" name="upload" id='uploadedFile' data-bind="value: image" />
            <input type="file" id="files" data-role="upload" 
                data-async='{"saveUrl": "upload.php","autoUpload": "true"}' data-success="onSuccess" name="files" />
                <input type="submit" value="update" />
                </form>
        </script>

<script type="text/x-kendo-template" id="template">

    <div class="subgrid"></div>

</script>



    <script>
        var del = "employee.php?";
        $(function() {
            $("#grid").kendoGrid({

                dataSource: {
                    transport: {
                        read: "employee.php",
            update: {
                url: "employee.php",
                type: "POST"
            },
            destroy: {
                url: "destroy.php",
                type: "POST",
                dataType:"json"
            },
            create: {
                url: "create.php",
                type: "POST"
                },
                parameterMap: function (options, operation) {
                        if (operation !== "read" && options.models) {
                            alert(options.pk_id);
                            return { data: {my: kendo.stringify(options.models)} };
                        }

                }

                    },
                     pageSize: 10,
                    error: function(e) {
                        alert(e.responseText);
                    },
                    schema: {
                        data: "data",
                        model:{
                            id:"pk_id",
                            fields:{
                                FirstName: { editable: true },
                    LastName: { validation: { required: true} },
                    image:{type: "string",defaultValue: ""}
                                }
                            }
                    }

                 },

                columns: [{ field: "FirstName",width: "100px" }, { field: "LastName",width: "50px" },{ command: [{text:"Edit", name:"edit"}, {text:"Delete", name:"destroy"}], title: " ", width: "110px" }],
                width: 510,
                toolbar: ["create"],
                detailTemplate: kendo.template($("#template").html()),
                detailInit: detailInit,
               editable:  {
                    mode: "popup",
                    template: kendo.template($("#productsEditTemplate").html())
                },
                height: 600,
                        filterable: true,
                        sortable: true,
                        pageable: {
                            input: true,
                            numeric: false
                        },
                save: function(e,c){
                        e.model.set("image",$("#uploadedFile").val());
                    }   

            });
        });



function onSuccess(e){  
                $("#uploadedFile").val(e.files[0].name);
        }
function detailInit(e) {
    // get a reference to the current row being initialized 
    var detailRow = e.detailRow;

    // create a subgrid for the current detail row, getting territory data for this employee

    detailRow.find(".subgrid").kendoGrid({
        dataSource: {
            transport: {
                 read: "terretories.php"
            },
            schema: {
                data: "data"
            },

            serverFiltering: true,
            filter: { field: "pk_id", operator: "eq", value:e.data.pk_id}
       },

       columns: [{ title: "Title", field: "title" },{ title: "Age", field: "age" },{ command: "destroy" }],

    });
}
    </script> 

</body>


</html>

使用剑道的积垢
名字
姓氏
var del=“employee.php?”; $(函数(){ $(“#网格”).kendoGrid({ 数据源:{ 运输:{ 阅读:“employee.php”, 更新:{ url:“employee.php”, 类型:“职位” }, 销毁:{ url:“destroy.php”, 类型:“POST”, 数据类型:“json” }, 创建:{ url:“create.php”, 类型:“职位” }, parameterMap:功能(选项、操作){ if(操作!=“读取”&&options.models){ 警报(选项.主键id); 返回{data:{my:kendo.stringify(options.models)}; } } }, 页面大小:10, 错误:函数(e){ 警报(如responseText); }, 模式:{ 数据:“数据”, 型号:{ id:“主键id”, 字段:{ 名字:{可编辑:true}, LastName:{验证:{必需:true}}, 图像:{类型:“字符串”,默认值:} } } } }, 列:[{field:“FirstName”,width:“100px”},{field:“LastName”,width:“50px”},{command:[{text:“Edit”,name:“Edit”},{text:“Delete”,name:“destroy”},title:,width:“110px”}, 宽度:510, 工具栏:[“创建”], detailTemplate:kendo.template($(“#template”).html()), detailInit:detailInit, 可编辑:{ 模式:“弹出”, 模板:kendo.template($(“#productsDittemplate”).html() }, 身高:600, 可过滤:正确, 可排序:是的, 可分页:{ 输入:正确, 数字:false }, 保存:功能(e、c){ e、 model.set(“image”,$(“#uploadedFile”).val(); } }); }); 函数onSuccess(e){ $(“#uploadedFile”).val(e.files[0].name); } 函数detailInit(e){ //获取对正在初始化的当前行的引用 var detailRow=e.detailRow; //为当前详细信息行创建子网格,获取此员工的区域数据 detailRow.find(“.subgrid”).kendoGrid({ 数据源:{ 运输:{ 阅读:“terretories.php” }, 模式:{ 数据:“数据” }, 是的, 筛选器:{字段:“pk_id”,运算符:“eq”,值:e.data.pk_id} }, 列:[{title:“title”,字段:“title”},{title:“Age”,字段:“Age”},{command:“destroy”}], }); }
php是

                   <?php
header("Content-type: application/json");
$con = mysql_connect("localhost", "root", "");
if (!$con)
{
  die('Could not connect: ' . mysql_error());
} else {
    mysql_select_db("northwind") or die("Unable To Connect To Northwind");
    $json  = file_get_contents("php://input");
 $verb = $_SERVER["REQUEST_METHOD"];
 if ($verb == "POST") {
 // $employeeId = mysql_real_escape_string($_GET["pk_id"]);

$data  = json_decode($json, true);



  $employeeId = $data[0]['pk_id'];
  echo $data[0]['pk_id'];

 // $employeeId = $json->pk_id;


   $rs = mysql_query("DELETE FROM employees WHERE pk_id = " .$employeeId);
   if ($rs) {
        echo json_encode($rs);
  }
  else {
        header("HTTP/1.1 500 Internal Server Error");
        echo "Failed on delete: " .$employeeId;
  }

 }
   mysql_close($con);
}
?> 

现在我不明白为什么parametermap不向destroy.php返回任何值? 或者我的php文件中有语法错误吗? 我完全糊涂了,请帮帮我
谢谢

在parameterMap中设置断点时会发生什么?您的警报是否被触发?