0
votes

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
Hi, did my answer help you solve your issue? If yes, could you please mark my reply as an answer? That way, people who find the question using Google can have more assurance that the answer is correct. Thanks in advance.Vladimir Iliev

1 Answers

1
votes

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)};