douwen9534 2015-10-09 05:43
浏览 90

Kendo DataSource更新不发送参数

I've just started using Kendo UI, I'm trying to use Kendo's DataSource to update Grid values, but checking on the backend PHP script that's set as the request url, it seems that the request is received, but with no POST parameters

dataSource: {                       
    transport: { 
        read: {
            type: "POST", 
            url: "model/master_service2_data.php?sp_type=INQ",
            dataType: "json" 
        },

        update: {
            url: "model/master_service2_data.php?sp_type=INS",
            type: "post",
            dataType: "json"
        },
        create: {
            url: "model/master_service2_data.php?sp_type=INS",
            type: "post",
            dataType: "json"
        },          
        parameterMap: function(options, operation) { 
            console.log(operation);
            console.log(options);
            if (operation !== "read" && options.models) {

                return {models: kendo.stringify(options.models)};
            }
        }
    },
    schema: { 
        data: "data",           
        total:  function (result) { 
                    result = result.data || result;
                    return result.length;
                },
        model: {                
            id: "Paket_Detail_ID",
            fields: {
                Paket_ID: { type: "string" },
                Paket_Detail_Desc: {type: "string"}                                             
            }
        }
    },
    pageSize: 20 
}

Looking at the output of console.log in the parameterMap function shows that options.models isn't available, does it matter? console.log(options) does show correct POST parameters, but they're just not received by the server script

  • 写回答

1条回答 默认 最新

  • dongyuying1507 2015-10-09 06:54
    关注

    As mentioned in the dataSource API, the "models" parameter is available only when the "batch" option of the dataSource is turned on. In your current case you should directly return the options back to the server:

     return {models: kendo.stringify(options)};
    
    评论

报告相同问题?

悬赏问题

  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line