Hi guys,
I am building a editable oj-table and i found validator of oj-input-date input box would not change to red colour. And the user allow to exit the edit mode if the field is blank.
Below is the code I have tried on cookbook:https://www.oracle.com/webfolder/technetwork/jet/jetCookbook.html?component=table&demo=editableArrayTable
I add on the code below into JS Editor
this.test_validators = {
validate: function (value) {
if (value === '' || value === null) {
throw new Error('Please complete this mandatory field');
} else {
}
},
getHint: function () {
return 'Please fill up the value';
}
};
then add on HTML Editor:
<template slot="dateTemplate" data-oj-as="cell">
<oj-bind-if test='[[cell.mode=="navigation"]]'>
<oj-bind-text value="[[dateConverter.format(cell.data)]]"></oj-bind-text>
</oj-bind-if>
<oj-bind-if test='[[cell.mode=="edit"]]'>
<oj-input-date id="id1" validators="[[[test_validators]]]" value="{{rowData.Date}}" > </oj-input-date>
</oj-bind-if>
</template>
and
<template slot="deptNameTemplate" data-oj-as="cell">
<oj-bind-if test='[[cell.mode=="navigation"]]'>
<oj-bind-text value="[[cell.data]]"></oj-bind-text>
</oj-bind-if>
<oj-bind-if test='[[cell.mode=="edit"]]'>
<oj-input-text id="it1" validators="[[[test_validators]]]" value="{{rowData.DepartmentName}}" ></oj-input-text>
</oj-bind-if>
</template>
I did compare oj-input-text, oj-input-number and oj-input-date, only oj-input-date cant work.
Not sure is that any extra coding needed on it? Hope someone can help on it
Thanks alot.