Had some time to roll out some more changes to SPWidgets, including a new Widget. Here is what’s new with Version 2.2:
(New) Date Widget – SPDateField
This new widget is rather simple and for the most part, it is a wrapper around jQuery UI Datepicker. The widget binds on to an HTML input field and displays a Datepicker. The benefit of using this widget instead of jQuery UI Datepicker directly is:
- Input field stores selected date(s) in the format expected by SharePoint API (ISO 8601, YYYY-MM-DD)
- User visible date is displayed using readable format (ex. mm/dd/yyyy)
- Support for selecting multiple dates
- Support for also defining Time (something jQuery UI does not provide)
- Like other widgets, it is localizable and and configurable
To use it, simply call SPDateField() on an input field and the widget is inserted into the place where the input is located on the page.
The actual input used when this widget is called is hidden and replaced with the UI displayed above, which uses the Datepicker and optionally the Timepicker. The dates selected will be stored using the format expected by SharePoint API (ie WebServices) – ISO 8601 (ex. 2013-09-02T17:05).
For more on its usage, checkout the documentation or the Demo Single Page Application (SPA) which has been updated to showcase this widget. The SPFilterPanel widget was also enhanced to display the Date and Time fields using this new widget.
Upload Widget – Refactored
The Upload widget has also been refactored and is now supported on SharePoint 2013. The look and feel of the widget was improved to fall inline with some of the more recent widgets, Additional input options were also added to make it easier for developers to integrate it in applications.
The widget remains compatible with SharePoint 2007 and 2010 and currently works only on Document Libraries, including those that may have Check In turned on.
Here is a short video of this plugin in action on the Demo Application page:
(New) ISO 8601 Date Parsing – parseDateString
In working with the new Date widgets it quickly became apparent that I needed a common method to parse ISO 8601 dates. SPWidgets already has a utility that can generate ISO 8601 date string. This utility takes as input a String representing the ISO 8601 date and return a Date object.
For more on this utility, see the document page.
Enhancements to the Filter Panel Widget
The filter panel widget, one of the most used widgets by me, has received the following enhancements:
- Date and Time fields now leverage the new Date widget
- Each column now has an option to match ALL or ANY of the values entered (use of logical AND or OR)
- Lookup fields now leverage the new picker from the SPWidget Lookup field
Head over to github to download the latest – purtuga.github.io/SPWidgets