I'm looking to use Kendo to enhance an existing PHP web app at the company I work for. Currently all of the data in the app is extracted from a MySQL database, processed and setup as an array, then output as an HTML table.
I'd like to use Kendo as a 'drop-in' replacement for the tables, which means all the data will come from PHP arrays. I've read the docco and got started using the PHP Wrapper, and the following code:
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data($my_array)
Most things are working great, and I'm very impressed. However there's one problem - dates aren't sortable. This is a pretty killer issue for the web app, given that it has a lot of inventory and sales information.
I think the problem is the format of the dates - currently they are 'raw' dates in d/MM/yyy format (no leading 0 on days). But I have also experimented with injecting them them as dd/MM/yyyy, yyyy-mm-dd, and unix time stamps (second since the epoch, otherwise know as date('u') in PHP). But no matter what I do, the dates always sort as if they are just numbers.
Does anyone know what date format is acceptable to Kendo UI's PHP Wrapper, when coming from a PHP array?
I've succesfully used format({0:c}) to represent currency information, and I've read that format({0:d}) can accomplish something with dates, but I've had no luck. I've also tried format({0:d/MM/yyyy}) and a handful of others, but it doesn't change the data.
Does the ->format() function have any relationship to sorting? Or does it just change the visual output of the columns?
I'm aware that I can hook Kendo up to the data sources directly (and that this is a preferred option), but as I said I'm attempting to use this as a 'drop-in' replacement for tables right now. It's not worth the effort of rewriting so much of the app at this stage, I'm just evaluating. Further, both Easy UI and dHTMLxGrid are capable of taking a PHP array that includes a date and treating it correctly, so I'd be very surprised if Kendo couldn't.
I would have thought this was a pretty common use case, but I can't find anything specific to this example in the docs, tutorials, API etc. Can anyone assist?
Regards,
Sam Miller
I'd like to use Kendo as a 'drop-in' replacement for the tables, which means all the data will come from PHP arrays. I've read the docco and got started using the PHP Wrapper, and the following code:
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data($my_array)
Most things are working great, and I'm very impressed. However there's one problem - dates aren't sortable. This is a pretty killer issue for the web app, given that it has a lot of inventory and sales information.
I think the problem is the format of the dates - currently they are 'raw' dates in d/MM/yyy format (no leading 0 on days). But I have also experimented with injecting them them as dd/MM/yyyy, yyyy-mm-dd, and unix time stamps (second since the epoch, otherwise know as date('u') in PHP). But no matter what I do, the dates always sort as if they are just numbers.
Does anyone know what date format is acceptable to Kendo UI's PHP Wrapper, when coming from a PHP array?
I've succesfully used format({0:c}) to represent currency information, and I've read that format({0:d}) can accomplish something with dates, but I've had no luck. I've also tried format({0:d/MM/yyyy}) and a handful of others, but it doesn't change the data.
Does the ->format() function have any relationship to sorting? Or does it just change the visual output of the columns?
I'm aware that I can hook Kendo up to the data sources directly (and that this is a preferred option), but as I said I'm attempting to use this as a 'drop-in' replacement for tables right now. It's not worth the effort of rewriting so much of the app at this stage, I'm just evaluating. Further, both Easy UI and dHTMLxGrid are capable of taking a PHP array that includes a date and treating it correctly, so I'd be very surprised if Kendo couldn't.
I would have thought this was a pretty common use case, but I can't find anything specific to this example in the docs, tutorials, API etc. Can anyone assist?
Regards,
Sam Miller