disable editing if getEditor returns false

This commit is contained in:
Faris Ansari 2018-03-07 15:56:07 +05:30
parent b3f281b214
commit 3651f23157
5 changed files with 76 additions and 20 deletions

View File

@ -2298,11 +2298,25 @@ class CellManager {
}
getEditor(colIndex, rowIndex, value, parent) {
// debugger;
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
if (obj && obj.setValue) return obj;
const column = this.datamanager.getColumn(colIndex);
const row = this.datamanager.getRow(rowIndex);
let editor = this.options.getEditor ?
this.options.getEditor(colIndex, rowIndex, value, parent, column, row) :
this.getDefaultEditor(parent);
// editing fallback
if (editor === false) {
// explicitly returned false
return false;
}
if (editor === undefined) {
// didn't return editor, fallback to default
editor = this.getDefaultEditor(parent);
}
return editor;
}
getDefaultEditor(parent) {
const $input = $.create('input', {
class: 'input-style',
type: 'text',
@ -3347,7 +3361,7 @@ var DEFAULT_OPTIONS = {
none: ''
},
freezeMessage: '',
getEditor: () => {},
getEditor: null,
addSerialNoColumn: true,
addCheckboxColumn: false,
enableClusterize: true,

View File

@ -2297,11 +2297,25 @@ class CellManager {
}
getEditor(colIndex, rowIndex, value, parent) {
// debugger;
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
if (obj && obj.setValue) return obj;
const column = this.datamanager.getColumn(colIndex);
const row = this.datamanager.getRow(rowIndex);
let editor = this.options.getEditor ?
this.options.getEditor(colIndex, rowIndex, value, parent, column, row) :
this.getDefaultEditor(parent);
// editing fallback
if (editor === false) {
// explicitly returned false
return false;
}
if (editor === undefined) {
// didn't return editor, fallback to default
editor = this.getDefaultEditor(parent);
}
return editor;
}
getDefaultEditor(parent) {
const $input = $.create('input', {
class: 'input-style',
type: 'text',
@ -3346,7 +3360,7 @@ var DEFAULT_OPTIONS = {
none: ''
},
freezeMessage: '',
getEditor: () => {},
getEditor: null,
addSerialNoColumn: true,
addCheckboxColumn: false,
enableClusterize: true,

View File

@ -2297,11 +2297,25 @@ class CellManager {
}
getEditor(colIndex, rowIndex, value, parent) {
// debugger;
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
if (obj && obj.setValue) return obj;
const column = this.datamanager.getColumn(colIndex);
const row = this.datamanager.getRow(rowIndex);
let editor = this.options.getEditor ?
this.options.getEditor(colIndex, rowIndex, value, parent, column, row) :
this.getDefaultEditor(parent);
// editing fallback
if (editor === false) {
// explicitly returned false
return false;
}
if (editor === undefined) {
// didn't return editor, fallback to default
editor = this.getDefaultEditor(parent);
}
return editor;
}
getDefaultEditor(parent) {
const $input = $.create('input', {
class: 'input-style',
type: 'text',
@ -3346,7 +3360,7 @@ var DEFAULT_OPTIONS = {
none: ''
},
freezeMessage: '',
getEditor: () => {},
getEditor: null,
addSerialNoColumn: true,
addCheckboxColumn: false,
enableClusterize: true,

View File

@ -430,11 +430,25 @@ export default class CellManager {
}
getEditor(colIndex, rowIndex, value, parent) {
// debugger;
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
if (obj && obj.setValue) return obj;
const column = this.datamanager.getColumn(colIndex);
const row = this.datamanager.getRow(rowIndex);
let editor = this.options.getEditor ?
this.options.getEditor(colIndex, rowIndex, value, parent, column, row) :
this.getDefaultEditor(parent);
// editing fallback
if (editor === false) {
// explicitly returned false
return false;
}
if (editor === undefined) {
// didn't return editor, fallback to default
editor = this.getDefaultEditor(parent);
}
return editor;
}
getDefaultEditor(parent) {
const $input = $.create('input', {
class: 'input-style',
type: 'text',

View File

@ -39,7 +39,7 @@ export default {
none: ''
},
freezeMessage: '',
getEditor: () => {},
getEditor: null,
addSerialNoColumn: true,
addCheckboxColumn: false,
enableClusterize: true,