Project

General

Profile

Task #2621

Task #2620: Replace HandsOnTable with jexcel

Make the editor work with the KV store editing

Added by Luke Murphey about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
04/01/2020
Due date:
% Done:

100%

History

#1 Updated by Luke Murphey about 4 years ago

  • Subject changed from Make the editor work with the KV store to Make the editor work with the KV store saving

#2 Updated by Luke Murphey about 4 years ago

            // Wire-up handlers for doing KV store dynamic updates
            if(this.lookup_type === "kv"){

                // For cell edits
                this.handsontable.addHook('afterChange', function(changes, source) {

                    // Ignore changes caused by the script updating the _key for newly added rows
                    if(source === "key_update"){
                        return;
                    }

                    // If there are no changes, then stop
                    if(!changes){
                        return;
                    }

                    // Iterate and change each cell
                    for(var c = 0; c < changes.length; c++){
                        var row = changes[c][0];
                        var col = changes[c][1];
                        var new_value = changes[c][3];

                        this.trigger("editCell", {
                            'row' : row,
                            'col' : col,
                            'new_value' : new_value
                        });
                    }

                }.bind(this));

                // For row removal
                this.handsontable.addHook('beforeRemoveRow', function(index, amount) {
                    // Iterate and remove each row
                    for(var c = 0; c < amount; c++){
                        var row = index + c;
                        this.trigger("removeRow", row);
                    }
                }.bind(this));

                // For row creation
                this.handsontable.addHook('afterCreateRow', function(row, count){
                    this.trigger("createRows", {
                        'row' : row,
                        'count' : count
                    });
                }.bind(this));

#4 Updated by Luke Murphey about 4 years ago

  • Subject changed from Make the editor work with the KV store saving to Make the editor work with the KV store editing

#5 Updated by Luke Murphey about 4 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF