Kendo Grid UI transport.destroy不会在数据源中触发服务

时间:2015-05-11 04:19:16

标签: kendo-grid asp.net-web-api

我是Kendo UI的新用户,当我使用正在使用该服务的Kendo Grid UI时,读取操作工作正常,并且网格中填充了来自服务的数据,但删除操作无法正常工作

我已经使用fiddler测试了删除服务获得了完美的响应,但我很困惑为什么kendo网格中的删除按钮没有触发端点

我过去一周挣扎但没有改善

这是我的代码,

      var carsDataSource1 = new kendo.data.DataSource(
      {

          batch: true,
          transport: {
              read: {
                  url: "/DesktopModules/MyServicesTest/API/DropData/Drop",
                  dataType: "json",
                  type: "GET",
                  contentType: "application/json; charset=utf-8",
              },
              destroy: {

                  url: function(options)
              {
                   return 'DesktopModules/MyServicesTest/API/DeleteCategory/
                    Delete' + options.models[0].id;

                  },
                  dataType: "json",
                  type: "DELETE"
              }, 
                parameterMap: function (options, operation) {
                  if (operation !== "read" && options.models) {
                      var CategoryID = options.models[0].id;
                      console.log(CategoryID);
                      return CategoryID;
                  }
              }
          },
            shema:
  {
      model: {
          id: "CategoryID",
          field: {
              CategoryID:
                 {
                     editable: false,
                     nullable: true,
                     type: "number"
                 },
             CategoryName:
                  {
                      editable: false,
                      nullable: false,
                      type: "string"
                  },

          }
      }
  }
      });


    $("#grid1").kendoGrid({
        dataSource: carsDataSource1,
        height: "500px",
        pageable: {
            refresh: true,
            pageSizes: true,
            buttonCount: 5
        },

        columns: [
              {
                  field: "CategoryID",
                  title: "number "
              },
            {
                field: "CategoryName",
                title: "Name"

            },

        { command:"destroy"}
        ],
        toolbar: ["create"],
        editable: "inline",
        destroy:true,

    });



});

0 个答案:

没有答案