I have a grid that I have hooked up to a PHP webservice. The dataSource.transport.read option is set to the following:
The bindData is just a boolean condition I'm setting so that it won't make requests to the webservice at certain points.
This works for normal functionality. The issue here is that I'm dynamically setting the pageSize option based on how much available vertical space is in the content area of the grid. So when I initialize it, I don't want to make a webservice request right away, so I set the option to false, calculate the space, set the pageSize, then want to make the call to run the transport function, but not sure how to do this properly. I can call it manually using $('#grid').data('kendoGrid').dataSource.transport.read(); but that doesn't send the parameters to it so the 'operation' parameter is undefined and the webservice doesn't get any of the paging, sorting or filtering options. And calling dataSource.read() or refresh() doesn't seem to work either.
How can I accomplish this? Is there a way to pass the transport function the necessary parameters or is there a better way to handle it?
Let me know if there's anything else you need.
function
(operation)
{
if
($(
'#grid'
).data(
'bindData'
) !==
false
)
{
var
params = operation.data;
params[
'id'
] = $(
'#grid'
).data(
'webServiceId'
);
$.ajax({
url:
'webservice.php'
,
contentType:
'application/json'
,
type:
'POST'
,
data: kendo.stringify(params),
success:
function
(response) { operation.success(response); }
});
}
}
The bindData is just a boolean condition I'm setting so that it won't make requests to the webservice at certain points.
This works for normal functionality. The issue here is that I'm dynamically setting the pageSize option based on how much available vertical space is in the content area of the grid. So when I initialize it, I don't want to make a webservice request right away, so I set the option to false, calculate the space, set the pageSize, then want to make the call to run the transport function, but not sure how to do this properly. I can call it manually using $('#grid').data('kendoGrid').dataSource.transport.read(); but that doesn't send the parameters to it so the 'operation' parameter is undefined and the webservice doesn't get any of the paging, sorting or filtering options. And calling dataSource.read() or refresh() doesn't seem to work either.
How can I accomplish this? Is there a way to pass the transport function the necessary parameters or is there a better way to handle it?
Let me know if there's anything else you need.