Hi,
I have been using the Grid php wrapper for a few days in a new web project. Most of it work fine, except one thing, to which I can't find the solution.
I followed the examples to set up a simple Grid using remote data, formatted as JSON, through a crud.php file. The problem is that when I use POST transport type to read data, the Grid won't show anything (even though my crud.php file returns a correct JSON result). The Grid works fine if I don't use POST to read data. However, create, update and destroy commands work fine with POST.
Here is the code :
The JSON data is just like this :
I could use my Grid with GET, but for obvious security reasons I'd rather not.
Any idea would be greatly appreciated.
I have been using the Grid php wrapper for a few days in a new web project. Most of it work fine, except one thing, to which I can't find the solution.
I followed the examples to set up a simple Grid using remote data, formatted as JSON, through a crud.php file. The problem is that when I use POST transport type to read data, the Grid won't show anything (even though my crud.php file returns a correct JSON result). The Grid works fine if I don't use POST to read data. However, create, update and destroy commands work fine with POST.
Here is the code :
$read
=
new
\Kendo\Data\DataSourceTransportRead();
$read
->url(
'users.crud.php?do=read'
)
->contentType(
'application/json'
)
->type(
'POST'
);
// If I remove this line, the Grid works, otherwise it's empty
// [...create, update, destroy use POST type...]
$transport
=
new
\Kendo\Data\DataSourceTransport();
$transport
->create(
$create
)
->read(
$read
)
->update(
$update
)
->destroy(
$destroy
)
->parameterMap(
'function mapParamsToJSON (data){return kendo.stringify(data);}'
);
The JSON data is just like this :
{
"data"
:[{
"id"
:
"6"
,
"username"
:
"Tom"
,
"password"
:
"xxxxxx"
}]}
I could use my Grid with GET, but for obvious security reasons I'd rather not.
Any idea would be greatly appreciated.