I am setting up a page using MySQL/PHP on the back end, and using a
DataSource + Kendo Grid for display. Having odd issues with date
fields I was hoping someone could shed some light on.
I have my transport set up like this:
transport: {
read: {
url: "services/crud/tbl-read.php",
dataType: "JSON"
},
create: {
url: "services/crud/tbl-add.php",
type: "POST"
},
update: {
url: "services/crud/tbl-edit.php",
type: "POST"
} ,
...
and the schema/model setup like this:
datefld : { editable: true, type: "date"},
and I have my Grid column display setup like this (using date format to match):
columns:[
{ field: "tbl_id", title: "ID", width: "50px" },
...
{ field: "datefld", title:"My Date Field", format: "{0:yyyy-MM-dd}" },
...
This retrieves and displays the date field properly. Grid also shows the built in date picker and so forth.
Where I run into trouble is when I ADD or EDIT. On an Add, the request
sent to my PHP script DOES NOT include a value pair for "datefld"
(!!??!!). I get value pairs for all the other (non-date) fields, not
the date field. Similarly on an EDIT, if I edit the date (using the
grid's supplied date picker) the PHP request does not include the value
pair for the date field. Oddly enough, if I edit the record in the
grid BUT only change one of the other (string) fields, I DO GET a value
pair for the date field (I am assuming since it was untouched by the
edit). As a test, I toggled the schema TYPE clause from "date" to
"string" and everything works as it should (data displays, value pairs
are included, but I obviously don't get a date picker in the grid).
A further issue with this setup is that built in grid filtering does not
work. If I attempt to filter on the date field (with TYPE set to
"date") I am unable to get the filter to apply - I get a spinning
wait/progress/hourglass deal. Obviously with type set to string I can
filter, but not as a date as desired.
My best guess is that Kendu does not like the date format, but I have
found limited information in the forums and documentation about date
formats (and none relating to MySQL, PHP and CRUD).
Anyone have similar issues? Anyone getting datefields to work properly with MySQL/PHP/CRUD?
No hay comentarios:
Publicar un comentario