Hi,
Hopefully someone can give me some pointers on this one. I'm using UI with Angular, and ran into a problem trying to use the datetimepicker as a column filter. The issue seems to occur when the dataSource is updated via the dataSource.data() method. I've managed to reproduce this in the dojo http://dojo.telerik.com/ELado/3
Strangely if I use the k-rebind attribute and populate the data directly onto the options, the issue doesn't occur, however using k-rebind causes issues with column hiding and sorting - dojo example http://dojo.telerik.com/avOKi
Thanks
Jason
5 Answers, 1 is accepted
Take a look at this updated demo. When you filtered originally, the Kendo DateTimePicker was getting a type error. This is because the dates in your data were actually strings rather than date/time objects.
Here's how I updated it:
GridCtrl.theData = { 'thumbs':
[{
'desc': 'Happy Gilmore',
'date': new Date('2015-03-16T08:32:03'),
},
{
'desc': 'Billy Madison',
'date': new Date('2015-03-17T16:42:57'),
},
{
'desc': 'The Wedding Singer',
'date': new Date('2015-03-31T07:37:21'),
},
{
'desc': 'Happy Gilmore',
'date': new Date('2015-03-22T06:26:50'),
},
{
'desc': 'Happy Gilmore',
'date': new Date('2015-03-16T15:42:03'),
},
{
'desc': 'The Waterboy',
'date': new Date('2015-03-07T09:55:51'),
},
]
};
Regards,
Pat
Telerik
Thanks Pat, that's a workaround for sure, but why does it work as intended with the same data when set via k-rebind? The data is coming from an API so obviously I'll need to iterate the data whenever there are date fields, which is a pain.
Thanks again.
Hello Jason,
k-rebind will destroy the original widget, and will recreate it using the changed options. See more details here - Updating widgets when options change
On the other hand when setting data through data method the data items must be of correct type as schema.model configuration will not be used to parse the items as stated in the method description.
Regards,
Nikolay Rusev
Telerik
Thanks Nikolay, is there a way to persist option changes back to a scope variable when using k-rebind then, so that the recreated widget has any filter/column changes.
Thanks.
Hello Jason,
There isn't event or similar to track when the k-rebind will trigger. However k-rebind="some property" means that whenever you change that "some property" k-rebind will be executed. That said you can track state (I'm not sure what exactly you mean here) right before touching that option.
Regards,
Nikolay Rusev
Telerik