With the 15.2 release of Ignite UI for jQuery™ a new set of editor controls were introduced including a reworked igDateEditor
. With a new design focused on simplicity and better UX out-of-the-box some features and their API were revised, removed and new ones added. This topic will cover the differences that will be helpful for developers migrating their applications to the new editors.
This topic aims to help with migration from old date editor to the new one. Different scenarios are viewed and how they were done before and how they can be done now.
This topic contains the following sections:
Option | Previously | Now |
---|---|---|
animationHideDuration animationShowDuration | Used to set animation duration when dropdown list is displayed/hidden. | As the igDateEditor doesn't support dropdown, these options are not supported for the control. |
button | This option was used to set visibility of spin and dropdown button. $(".selector").igDateEditor({ button : "dropdown" }); |
This option is renamed to buttonType to better communicate what it does. For date editor the supported types are 'spin' and 'clear'.$(".selector").igDateEditor({ buttonType : "spin" }); |
dataMode | Members of type 'string' and 'number' were supported.$(".selector").igDateEditor({ dataMode: 0 }); |
Members of type 'number' are not supported.$(".selector").igDateEditor({ dataMode: "editModeText" }); |
display | Sets gets style.display for outer html element. | This option is removed. |
dropDownOnReadOnly | This option was used to set ability to override the "readOnly" option and allow showing the dropdown list and changing the value in the editor from a list. | This option is no longer available for the date editor. |
dropDownTriggers | Sets gets list of actions which trigger display of drop-down list or calendar. | This option is no longer available for the date editor. |
focusOnSpin | If that option was disabled and the editor was not focused, then a mouse click on the spin button would keep the text in the editor in not focused format and perform spin actions. | This option is removed. Now if the editor is not focused, then a mouse click on the spin button will not focus the editor. |
height, width | Previously supported type: number .$(".selector").igDateEditor({ width : 200 }); |
Now supported types are: number , string , null . If using type string , the height can be set in pixels (px) and percentage (%).$(".selector").igDateEditor({ width : "200px" }); |
hideEnterKey | Sets gets ability to hide the Enter key from browser.$(".selector").igDateEditor({ hideEnterKey : false }); |
This option is removed. You can use preventSubmitOnEnter option to prevent submitting when pressing Enter.$(".selector").igDateEditor({ preventSubmitOnEnter : true }); |
hideMaskOnFocus | Set ability to hide mask in focus state. | This option is removed. |
listAutoComplete | Sets gets autocomplete. | This option is removed. |
listColumns | Sets gets number of columns in drop-down list. | This option is removed. |
listDropDownAsChild | Value true created html element for list as a child of main html element. Value false created list as a child of body. |
This option is no longer available for the date editor. |
listMatchContains | Sets gets list match contains. | This option is removed. |
listMatchIgnoreCase | Sets gets case validation. | This option is removed. |
listMaxHeight | Used to set maximum height of dropdown list in pixels. | This option is no longer available for the date editor. |
listWidth | Sets gets custom width of drop-down list in pixels. If value is equal to 0 or negative, then the width of editor is used. | This option is removed. |
nullable | This option was used to set ability to prevent null value.$(".selector").igDateEditor({ nullable : false }); |
This option is renamed to allowNullValue to better communicate what it does.$(".selector").igDateEditor({ allowNullValue: true }); |
nullText | Used to set text which appears in editor when editor has no focus and "value" in editor is null or empty string.$(".selector").igDateEditor({ nullText : "Enter Value" }); |
This option is renamed to placeHolder to better communicate what it does.$(".selector").igDateEditor({ placeHolder : "Enter Value" }); |
renderInContainer | Sets gets option to wrap input field into SPAN. | This option is removed. |
required | Set gets validation for empty value in editor.$(".selector").igDateEditor({ required : true }); |
This options is removed. You can use the validator options to set the field as required.$(".selector").igDateEditor({ validatorOptions : { required: true } }); |
selectionOnFocus | Previously supported members: select , -1 , start , 0 , end , 1 , default , 2 .$(".selector").igDateEditor({ selectionOnFocus: 0 }); |
Now supported members are: selectAll , atStart , atEnd , browserDefault . The default value is selectAll .$(".selector").igDateEditor({ selectionOnFocus: "atStart" }); |
spin1Field | Sets gets ability to modify only 1 date field on spin events.$(".selector").igDateEditor({ spin1Field : true }); |
This option is renamed to limitSpinToCurrentField.$(".selector").igDateEditor({ limitSpinToCurrentField : true }); |
spinOnReadOnly | This was used to override the "readOnly" option and allow changing "value" of editor on spin events.$(".selector").igDateEditor({ spinOnReadOnly : true }); |
This option is removed. Setting readOnly to true disables the spin buttons.$(".selector").igDateEditor({ readOnly : true `}); |
textAlign | Default was null |
Now default is left . |
theme | Sets gets selector for css classes used by editor. | This option is removed. |
type | Sets type of editor. | This option is removed. You can use the corresponding controls. |
Option | Description |
---|---|
limitSpinToCurrentField | Sets gets ability to modify only 1 date field on spin events. |
allowNullValue | If that option is false, and editor has no value, then value is set to an empty string. |
disabled | Use to set the disabled attribute. Does not allow editing. Disables all the buttons and iteracitons applied. On submit the current value is not sent into the request: $('#dateEditor').igDateEditor({ disabled: true }) . |
buttonType | Sets gets visibility of spin, clear and drop-down button. |
placeHolder | Gets sets text which appears in editor when editor has no focus and "value" in editor is null or empty string. |
revertIfNotValid | Use to set the editor to revert value to previous value in case of not valid value on blur, or enter key. |
preventSubmitOnEnter | Use to set the ability of the editor to prevent form submition on enter key pressed: $('#dateEditor').igDateEditor({ preventSubmitOnEnter: true }) . |
suppressNotifications | Disables default notifications for basic validation scenarios built in the editors such as required list selection, value wrapping around or spin limits. |
Method | Previously | Now |
---|---|---|
addListItem | Used to add the object within item at the location indicated by the index. | This method is removed. |
addListItems | Used to add the objects within the items array at the location indicated by the index. | This method is removed. |
clearListItems | Removed all items from list. | This method is removed. |
dropDownElement | Got reference to jquery object which is used as container of dropdown. | This method is removed. |
dropDownVisible | Set visibility of dropdown list according to the Boolean value that is passed. | This method is removed. |
findListItemIndex | Found index of list item by text that matches with the search parameters. | This method is removed. |
getRegionalOption | Gets calculated value of regional option used by numeric and date editors. | This method in no longer available. |
getSelection | Used to get left or right edge of selection. | This method is replaced by the methods getSelectionStart and getSelectionEnd . |
getValueByMode | Used to get value in editor by dataMode. | This method is not supported. |
hasInvalidMessage | Used to check if invalid message is displayed. | This method is removed as its` functionality is covered by the API for the igEditorNotifier. |
mainElement | Used to get reference to jquery object which is used as top/outer element of igDateEditor . |
This method is renamed to editorContainter to better communicate what it does. |
paste | Used to paste text at location of caret. | This is renamed to insert and the txt parameter is renamed to string as it is a string of characters. |
remove | This was used to remove editor from its parent element, but keeps the rest of functionality. | This method is not supported. |
removeListItem | Used to remove item from list. | This method is removed. |
removeListItemAt | Used to remove item from list at index. | This method is removed. |
select | Used to select text in editor. Valid parameters: sel0 , sel1 , val |
sel0 is renamed to start and sel1 is renamed to end to prevent exchanging the two parameters. |
setFocus | Used to set focus to editor with delay. If parameter was -1, then focus was set without delay. | It now supports only positive values for the delay and 0 is default that signifies that it is immediately given the focus. |
spin | Used to increment (positive delta) or decrement (negative delta) value in editor according to the parameter. | This method is replaced by two new methods: spinUp and spinDown . |
text | Used to get or set text in editor. | This is replaced by a getter method displayValue that takes no parameters and returns a string with all the characters shown in the input. |
Method | Description |
---|---|
getSelectedDate | Gets selected date. |
selectDate | Sets selected date. |
inputName | Gets sets name attribute applied to the editor element. |
displayValue | Returns a string with all the characters shown in the input. |
editorContainer | Gets reference to jquery object which is used as top/outer element of igEditor. |
clearButton | Returns a reference to the clear button of the editor. |
getSelectionStart | Gets start index of the selected text in editor. |
getSelectionEnd | Gets end index of the selected text in editor. |
insert | Paste text at location of caret. |
spinUp | Increase date-time period, depending on the cursor position. |
spinDown | Decrease date-time period, depending on the cursor position. |
spinUpButton | Returns a reference to the spin up button of the editor. |
spinDownButton | Returns a reference to the spin down button of the editor. |
Note: One of the major changed in the new date editor is that it no longer supports Lists and DropDown. Note that if you try to use methods connected to dropdown and list, you will receive a notification pointing out that they are no longer available.
Event | Changes |
---|---|
hideDropDown | Event is not supported anymore. |
showDropDown | Event is not supported anymore. |
listSelected | Event is not supported anymore. |
listSelecting | Event is not supported anymore. |
mouseleave | Event is renamed to mouseout to better communicate what it does. |
Event | Description |
---|---|
rendering | Event which is raised before rendering of the editor completes. |
rendered | Event which is raised after rendering of the editor completes. |
mouseout | Event which is raised on mouseleave at any part of editor including drop-down list. |
Lib | Prev required version | New required version |
---|---|---|
jQuery core | 1.4.4 | 1.9.1 |
jQuery UI | 1.7 | 1.9.0 |
View on GitHub