Jump to:

5514 Posts in 1733 Topics by 1219 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Add Date Picker Field to Reports

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 604 Views
  • radialgraphics
    Avatar
    Community Member
    1 Post

    Add Date Picker Field to Reports Link to this post

    Hi there

    I am building a custom report in the CMS and cannot get a date picker calendar to appear. The code I am using to insert this on the report is:

    $DateField = new Datefield('StartDate','Start Date');
    $DateField->setConfig('showcalendar', true);
    $DateField->setConfig('dateformat', 'YYYY-MM-dd');

    $params->push($DateField);

    I then reference the $params field as follows:

    $Records = DataObject::get("Member", "Created between '" . $params['StartDate'] ."' and '" . $params['EndDate'] ."'", "Created DESC", Null);

    The field is inserted into the report but just as a text field.

    I can get the date picker working using this code if I add the code to a content page and add the field to a tab but not on the Reports page.

    Any help with this would be much appreciated.

    P.S. this is my first post and I am loving SilverStripe...

    Peter

  • Stef87
    Avatar
    Community Member
    66 Posts

    Re: Add Date Picker Field to Reports Link to this post

    Hi

    I was just wondering if you solved this? The following quote from this post is the best I've found but I'm still a little unclear on how to do this.

    Note that the jquery popup date picker field won't work in the report admin area if you want to use it. I had to create a custom extension which would include the JS requirements, as well as a little but of custom CSS to make it look OK. However, if you're happy with a text field for date input you'll have no problems.

    Thanks

    604 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.