Skip to content

Commit ba42d61

Browse files
WIP
1 parent 9c4facd commit ba42d61

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/toolbar.html

+5
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@
463463
</div>
464464
</div>
465465
</div>
466+
466467
<div class="modal fade" id="save-as-modal" tabindex="-1" role="dialog">
467468
<div class="modal-dialog" role="document">
468469
<div class="modal-content">
@@ -577,6 +578,7 @@
577578
</div>
578579
</div>
579580
</div>
581+
580582
<div class="modal fade" id="export-to-modal" tabindex="-1" role="dialog">
581583
<div class="modal-dialog" role="document">
582584
<div class="modal-content">
@@ -635,6 +637,7 @@
635637
</div>
636638
</div>
637639
</div>
640+
638641
<div class="modal fade" id="open-error-modal" tabindex="-1" role="dialog">
639642
<div class="modal-dialog" role="document">
640643
<div class="modal-content">
@@ -660,6 +663,7 @@
660663
</div>
661664
</div>
662665
</div>
666+
663667
<div
664668
class="modal fade"
665669
id="upload-template-error-modal"
@@ -690,6 +694,7 @@
690694
</div>
691695
</div>
692696
</div>
697+
693698
<div class="modal fade" id="jump-to-modal" tabindex="-1" role="dialog">
694699
<div class="modal-dialog" role="document">
695700
<div class="modal-content">

lib/utils/1m.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -792,9 +792,16 @@ export class OneToManyEventTracker extends EventTracker {
792792
if (source === 'loadData' || !changes) return;
793793

794794
const rowChanges = changesToRows(changes);
795+
const columnIndex = dh.getColumnIndexByFieldName(foreign_key_slot);
795796
const impactedRows = computeImpactedRows(rowChanges);
796797
const hasDeleteActions = impactedRows.some(row => row.action === ACTION.DELETE);
797-
798+
const isPrimaryKeyChange = changes.some(([row, col]) => col === columnIndex);
799+
800+
if (isPrimaryKeyChange) {
801+
// TODO: check
802+
return false;
803+
}
804+
798805
if (hasDeleteActions) {
799806
// WIP!
800807
// Immediately return false to block the change
@@ -803,7 +810,7 @@ export class OneToManyEventTracker extends EventTracker {
803810
// If the user confirmed, reapply the changes programmatically
804811
changes.forEach(([row, col, oldValue, newValue]) => {
805812
dh.hot.setSourceDataAtCell(row, col, newValue);
806-
dh.hot.setDataAtCell(row, col, newValue);
813+
// dh.hot.setDataAtCell(row, col, newValue);
807814
});
808815
// const newData = dh.hot.getData(); // get updated source data
809816
// changes.forEach(([row, col, oldValue, newValue]) => {

0 commit comments

Comments
 (0)