fix editable property of columns being ignored in data_editor (#2338)
This commit is contained in:
parent
c5c42665eb
commit
78429866bd
@ -1,4 +1,4 @@
|
|||||||
import { GridCellKind } from "@glideapps/glide-data-grid"
|
import { GridCellKind } from "@glideapps/glide-data-grid";
|
||||||
|
|
||||||
export function getDEColumn(columns, col) {
|
export function getDEColumn(columns, col) {
|
||||||
let c = columns[col];
|
let c = columns[col];
|
||||||
@ -19,7 +19,7 @@ export function locateCell(row, column) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function formatCell(value, column) {
|
export function formatCell(value, column) {
|
||||||
const editable = column.editable || true
|
const editable = column.editable ?? true;
|
||||||
switch (column.type) {
|
switch (column.type) {
|
||||||
case "int":
|
case "int":
|
||||||
case "float":
|
case "float":
|
||||||
@ -29,7 +29,7 @@ export function formatCell(value, column) {
|
|||||||
displayData: value + "",
|
displayData: value + "",
|
||||||
readonly: !editable,
|
readonly: !editable,
|
||||||
allowOverlay: editable,
|
allowOverlay: editable,
|
||||||
}
|
};
|
||||||
case "datetime":
|
case "datetime":
|
||||||
// value = moment format?
|
// value = moment format?
|
||||||
case "str":
|
case "str":
|
||||||
@ -39,22 +39,24 @@ export function formatCell(value, column) {
|
|||||||
displayData: value,
|
displayData: value,
|
||||||
readonly: !editable,
|
readonly: !editable,
|
||||||
allowOverlay: editable,
|
allowOverlay: editable,
|
||||||
}
|
};
|
||||||
case "bool":
|
case "bool":
|
||||||
return {
|
return {
|
||||||
kind: GridCellKind.Boolean,
|
kind: GridCellKind.Boolean,
|
||||||
data: value,
|
data: value,
|
||||||
readonly: !editable,
|
readonly: !editable,
|
||||||
}
|
};
|
||||||
default:
|
default:
|
||||||
console.log("Warning: column.type is undefined for column.title=" + column.title)
|
console.log(
|
||||||
|
"Warning: column.type is undefined for column.title=" + column.title
|
||||||
|
);
|
||||||
return {
|
return {
|
||||||
kind: GridCellKind.Text,
|
kind: GridCellKind.Text,
|
||||||
data: value,
|
data: value,
|
||||||
displayData: column.type
|
displayData: column.type,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export function formatDataEditorCells(col, row, columns, data) {
|
export function formatDataEditorCells(col, row, columns, data) {
|
||||||
if (row < data.length && col < columns.length) {
|
if (row < data.length && col < columns.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user