disable editing if getEditor returns false
This commit is contained in:
parent
b3f281b214
commit
3651f23157
24
dist/frappe-datatable.cjs.js
vendored
24
dist/frappe-datatable.cjs.js
vendored
@ -2298,11 +2298,25 @@ class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEditor(colIndex, rowIndex, value, parent) {
|
getEditor(colIndex, rowIndex, value, parent) {
|
||||||
// debugger;
|
const column = this.datamanager.getColumn(colIndex);
|
||||||
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
|
const row = this.datamanager.getRow(rowIndex);
|
||||||
if (obj && obj.setValue) return obj;
|
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', {
|
const $input = $.create('input', {
|
||||||
class: 'input-style',
|
class: 'input-style',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -3347,7 +3361,7 @@ var DEFAULT_OPTIONS = {
|
|||||||
none: ''
|
none: ''
|
||||||
},
|
},
|
||||||
freezeMessage: '',
|
freezeMessage: '',
|
||||||
getEditor: () => {},
|
getEditor: null,
|
||||||
addSerialNoColumn: true,
|
addSerialNoColumn: true,
|
||||||
addCheckboxColumn: false,
|
addCheckboxColumn: false,
|
||||||
enableClusterize: true,
|
enableClusterize: true,
|
||||||
|
|||||||
24
dist/frappe-datatable.js
vendored
24
dist/frappe-datatable.js
vendored
@ -2297,11 +2297,25 @@ class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEditor(colIndex, rowIndex, value, parent) {
|
getEditor(colIndex, rowIndex, value, parent) {
|
||||||
// debugger;
|
const column = this.datamanager.getColumn(colIndex);
|
||||||
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
|
const row = this.datamanager.getRow(rowIndex);
|
||||||
if (obj && obj.setValue) return obj;
|
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', {
|
const $input = $.create('input', {
|
||||||
class: 'input-style',
|
class: 'input-style',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -3346,7 +3360,7 @@ var DEFAULT_OPTIONS = {
|
|||||||
none: ''
|
none: ''
|
||||||
},
|
},
|
||||||
freezeMessage: '',
|
freezeMessage: '',
|
||||||
getEditor: () => {},
|
getEditor: null,
|
||||||
addSerialNoColumn: true,
|
addSerialNoColumn: true,
|
||||||
addCheckboxColumn: false,
|
addCheckboxColumn: false,
|
||||||
enableClusterize: true,
|
enableClusterize: true,
|
||||||
|
|||||||
@ -2297,11 +2297,25 @@ class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEditor(colIndex, rowIndex, value, parent) {
|
getEditor(colIndex, rowIndex, value, parent) {
|
||||||
// debugger;
|
const column = this.datamanager.getColumn(colIndex);
|
||||||
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
|
const row = this.datamanager.getRow(rowIndex);
|
||||||
if (obj && obj.setValue) return obj;
|
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', {
|
const $input = $.create('input', {
|
||||||
class: 'input-style',
|
class: 'input-style',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
@ -3346,7 +3360,7 @@ var DEFAULT_OPTIONS = {
|
|||||||
none: ''
|
none: ''
|
||||||
},
|
},
|
||||||
freezeMessage: '',
|
freezeMessage: '',
|
||||||
getEditor: () => {},
|
getEditor: null,
|
||||||
addSerialNoColumn: true,
|
addSerialNoColumn: true,
|
||||||
addCheckboxColumn: false,
|
addCheckboxColumn: false,
|
||||||
enableClusterize: true,
|
enableClusterize: true,
|
||||||
|
|||||||
@ -430,11 +430,25 @@ export default class CellManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getEditor(colIndex, rowIndex, value, parent) {
|
getEditor(colIndex, rowIndex, value, parent) {
|
||||||
// debugger;
|
const column = this.datamanager.getColumn(colIndex);
|
||||||
const obj = this.options.getEditor(colIndex, rowIndex, value, parent);
|
const row = this.datamanager.getRow(rowIndex);
|
||||||
if (obj && obj.setValue) return obj;
|
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', {
|
const $input = $.create('input', {
|
||||||
class: 'input-style',
|
class: 'input-style',
|
||||||
type: 'text',
|
type: 'text',
|
||||||
|
|||||||
@ -39,7 +39,7 @@ export default {
|
|||||||
none: ''
|
none: ''
|
||||||
},
|
},
|
||||||
freezeMessage: '',
|
freezeMessage: '',
|
||||||
getEditor: () => {},
|
getEditor: null,
|
||||||
addSerialNoColumn: true,
|
addSerialNoColumn: true,
|
||||||
addCheckboxColumn: false,
|
addCheckboxColumn: false,
|
||||||
enableClusterize: true,
|
enableClusterize: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user