如何在igGrid更新中的igTextEditor上使用正則表達式?如何在IgGrid細胞中獲得正則表達(Infragistics)?
我試圖使用驗證選項,但它沒有奏效。
$("#schedulerTable").igGrid({
columns: $scope.schedulerColumns,
width: "87%",
height: "300px",
fixedHeaders: true,
autoGenerateColumns: false,
autofitLastColumn: true,
autoCommit: true,
renderCheckboxes: true,
responseDataKey: "results",
dataSource: $scope.schedulerData,
updateUrl: "",
primaryKey: 'Id',
features: [
{
name: "Updating",
generatePrimaryKeyValue: function (evt, ui) {
nextPrimarykey -= 1;
ui.value = nextPrimarykey;
},
enableAddRow: true,
enableDeleteRow: true,
editMode: "row",
columnSettings: [
{
columnKey: "Id",
editorType: "numeric",
editorOptions: {
readOnly: true
}
}, {
columnKey: "Time",
editorType: "text",
editorOptions: {
},
validatorOptions: {
regExp: /^[a-zA-Z]{1}[a-zA-Z0-9_\.\-]*\@\w{2,10}\.\w{1,10}$/,
onblur: true,
onchange: true
},
required: true,
validation: true,
defaultValue: "00:00"
},
{
columnKey: "Mo"
},
{
columnKey: "Tu"
},
{
columnKey: "We"
},
{
columnKey: "Th"
},
{
columnKey: "Fi"
}]
}]
});
我想實現時間列中的時間選擇器,但不存在,所以我嘗試通過正則表達式獲取textEditor中的時間。 網格將加載名爲Time,Mo- Friday的列。 如果您點擊添加網格,您可以點擊輸入字段並填寫您的時間。在點擊完成之前應該驗證時間並顯示錯誤消息。
,看看錶什麼樣子:https://codepen.io/ablablabla/pen/PJLbJz
任何html代碼來理解這個單獨的JS代碼。 – 2017-10-19 15:51:10
@headmax如果您使用infragistics工具,您可以創建一個網格,只需在div的id上調用igGrid。所以如果你要測試這個或者檢查它,你所要做的就是callig $('#whatever')。igGrid({});獲得完整的工作網格。 – Amsel
例如這個https://codepen.io/headmax/pen/QqYZgq – 2017-10-20 07:39:52