This is a migrated thread and some comments may be shown as answers.

group with Web Service problem

2 Answers 71 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Cyndie
Top achievements
Rank 1
Cyndie asked on 23 May 2012, 07:17 PM
If I configure a datasource to query a web service (.asmx) with a group method, it sends a Request Body of

group%5B0%5D%5Bfield%5D=MaximoRequestNumber&group%5B0%5D%5Bdir%5D=asc

Which causes an Invalid JSON primitive error.  Is there a way to group the data without having the dataSource send the grouping option to the service?  I know that I can group in the grid's dataBound method, but if I refresh the dataSource, it sends the dreaded group string as non-JSON text in the Request Body and it errors.
var readOrdersSource = new kendo.data.DataSource({
    transport: {
        read: {
            url: webServiceBaseUrl + "getOrderedTransformers",
            contentType: 'application/json; charset=utf-8',
            type: "POST",
            dataType: "json"
        }
    },
    schema: {
        data: "d",
        model: {
            id: "id",
            fields: {
                id: { type: "number" },
                MaximoItemNumber: { type: "string" },
                MaximoRequestNumber: { type: "string" },
                AddedBy: { type: "string" },
                AddDate: { type: "datetime" },
                KVA: { type: "number" },
                PrimaryVoltage: { type: "string" },
                SecondaryVoltage: { type: "string" },
                OilType: { type: "string" },
                Phase: { type: "number" }
            }
        }
    },
    group: {
        field: "MaximoRequestNumber"
    },
    parameterMap: function (options) {
        return JSON.stringify(options)
    }
});

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 25 May 2012, 10:13 AM
Hi,

 By default all settings are passed to the parameterMap. However you can remove the ones which are of no ineterest:

parameterMap: function(options) {
    delete options.group;
     
    return JSON.stringify(options);
}

All the best,
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Cyndie
Top achievements
Rank 1
answered on 25 May 2012, 02:39 PM
As it turns out, I had my parameterMap in the wrong place.  It was outside of the transport section.  This is good information though.

Thanks!
Tags
Data Source
Asked by
Cyndie
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Cyndie
Top achievements
Rank 1
Share this question
or