Hello,
I'm using the following javascript method to remotely bind a datasource. I am trying to pass the "headers" array to the web service
At runtime, the headers parameter in the web service method (shown below) is of type object. If I specify a type other than object in the method signature (eg: string[] or string), then headers is null.
Can anyone help me get the values I'm sending in the format it was sent?
Thanks!
Edit: After looking in firebug, my POST parameters being sent are :
"
I'm using the following javascript method to remotely bind a datasource. I am trying to pass the "headers" array to the web service
function
changeColumns() {
var
headers =
new
Array();
$(
"#columns"
).children().each(
function
() {
if
($(
this
).attr(
"checked"
) ==
"checked"
) {
headers.push($(
this
).attr(
"id"
));
}
});
var
grid = $(
"#GridTest"
).data(
"kendoGrid"
);
var
ds = grid.dataSource;
grid.columns = [];
grid.thead.remove();
ds.data({
transport: {
read: {
url: controller +
"Test_Read"
,
dataType:
"json"
,
data: { headers: headers }
},
parameterMap:
function
(options) {
return
kendo.stringify(options);
},
type:
"json"
},
pageSize: 10,
serverPaging:
true
,
serverFiltering:
true
,
serverSorting:
true
});
$(
"#GridTest"
).kendoGrid({
dataSource: ds,
scrollable:
true
,
sortable:
true
,
reorderable:
true
,
resizable:
true
}).data(
"kendoGrid"
);
}
At runtime, the headers parameter in the web service method (shown below) is of type object. If I specify a type other than object in the method signature (eg: string[] or string), then headers is null.
public
ActionResult Test_Read([DataSourceRequest] DataSourceRequest request,
object
headers =
null
)
{
return
Json(GetProductsDynamic(headers).ToDataSourceResult(request));
}
Can anyone help me get the values I'm sending in the format it was sent?
Thanks!
Edit: After looking in firebug, my POST parameters being sent are :
"
sort=&page=1&pageSize=10&group=&filter="
So it seems the data isn't being sent at all.