{ field:'personId', headerText:'Person', dataSource: $root.currentUser().personnelDisplay(), foreignKeyField: 'id', foreignKeyValue: 'label', type: 'guid', editParams: { watermarkText: 'Select an item...' }, editType: ej.Grid.EditingType.Dropdown, validationRules: { required: true } },
Will not fire the column validation without the dataSource containing an item with id empty, null or undefined.
Is there an existing way to accommodate this requirement?
If not, it would be ideal if when validationRules-> Required is specified and a watermark provided, if the cell editor included it without developers having to modify their source collections to accommodate this limitation.
Robert
Here is what I observed.
With the column using the drop down edit type, a validation rule of required and a data source without an empty value, a row could be committed without making a selection.
This was because the jQuery validate implementation for a select uses .val() on the element. In the case of the ejDropDownList, this returned the first value from the list, though the getSelectedValue method of the instance showed that there was no selection (as did the hidden input element for the column/cell.
To workaround this issue, I created a custom jQuery Validation rule to adapt to the ejDropDownList behavior (I had a release deadline and had not received feedback - needed to push forward.)
Here is the custom rule to remedy this issue (where the app.resources is a collection of localized strings from the host web API):
Robert