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.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Date formatting not working #92461

    emberq
    Participant

    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.

    Date formatting not working #92463

    emberq
    Participant

    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.

    Date formatting not working #92548

    emberq
    Participant

    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. 🙂

    Date formatting not working #92561

    Hristo
    Participant

    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 Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Date formatting not working #92568

    emberq
    Participant

    Thanks 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.

    Date formatting not working #92582

    Hristo
    Participant

    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-format

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

    Date formatting not working #92604

    emberq
    Participant

    OK I see what you mean. And I can format the date using the method in your other example above. Thanks very much.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.