jQuery UI Widgets › Forums › Plugins › Data Adapter › Date formatting not working
This topic contains 6 replies, has 2 voices, and was last updated by emberq 7 years, 8 months ago.
-
Author
-
I have a simple case of an array of { date: new Date() } and this code to prep it for loading into a jqxDropDownList:
var deliverySource = new $.jqx.dataAdapter({
datatype: ‘array’,
datafields: [
{ name: ‘date’, type: ‘date’, format: ‘dd/MM/yyyy’ }
],
localdata: ar
});I cannot get the date to format. The dropdown always displays the default date toString. I cannot find an example because all the samples use jqxGrid and column formatting for dates.
Also, related to loading the jqXDropDownList, I have another issue. I am changing localdata but not seeing any change in the dropdownlist. If I set the dropdownlist’s source directly to an array and change the array, then the list content changes. But if I’m using dataadapter and change the the adapter’s locadata, the list content doesn’t change.
Thank you.
Sorry, I think that first item is a little vague. What I’m looking for is a simple example of a drop down list displaying just dates. The dates come from an array of { date: new Date() }. It uses a dataAdapter where the date field has a format spec like ‘yyyy’.
That’s all. Because I cannot get this to work and believe me I’ve tried. 🙂
Hello emberq,
Please, take a look at this example:
https://www.jseditor.io/?key=2eba87b5766611e587c980ee734cf820
There you will find how to set desired date format.Best Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comThanks but you’re not using ‘format:’ in the date datafield of the source, which is what I am trying to get work. I think it’s documentedin the adapter documentation that’s it’s supposed to work that way with a date format specification.
Hello emberq,
The
format
member of the DataAdapter as a pattern that should describe the date format to match.
Please, take a look at this example:
https://www.jseditor.io/?key=jqxgrid-date-formatBest Regards,
Hristo HristovjQWidgets team
http://www.jqwidgets.comOK I see what you mean. And I can format the date using the method in your other example above. Thanks very much.
-
AuthorPosts
You must be logged in to reply to this topic.