diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableController.js index 397ce02ece33c32aeb83c600d313cc77aa6d8e49..7f46e0a994fadb002c77c7d52b2a94325783fa92 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableController.js @@ -46,6 +46,11 @@ function FreeFormTableController(sample, isEnabled) { this._freeFormTableView.addTable(newTableIndex, $newTableContainer); } + this.deleteTable = function(tableIdx) { + this._freeFormTableModel.tables.splice(tableIdx, 1); //Removes from model + this._freeFormTableView.deleteTable(tableIdx); //Removes from view + } + this.setTableSize = function(tableIdx, numRow, numCols) { } diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableView.js index b620e20572bb16cbfd5770fa3aba7faa1b4cc95c..2f5cbf5c99900f43f87a338cf3e159f0f2e68984 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableView.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleForm/widgets/FreeFormTableView.js @@ -179,6 +179,10 @@ function FreeFormTableView(freeFormTableController, freeFormTableModel) { $toolBarBtnAT.click(addTableFunc(tableIdx)); var $toolBarBtnDT = FormUtil.getButtonWithText('- Table' ,null).attr('title', 'Delete Table.').tooltipster(); + var removeTableFunc = function(tableIdx) { + return function() { _this._freeFormTableController.deleteTable(tableIdx); }; + } + $toolBarBtnDT.click(removeTableFunc(tableIdx)); if(this._freeFormTableModel.isEnabled) { $toolBar @@ -212,7 +216,12 @@ function FreeFormTableView(freeFormTableController, freeFormTableModel) { } else { this._tableContainers[tableIdx-1].after($tableContainer); //Update View adding Table } - this._tableContainers.push($tableContainer); //Update View Structure + this._tableContainers.splice(tableIdx, 0, $tableContainer); //Update View Structure + } + + this.deleteTable = function(tableIdx) { + this._tableContainers[tableIdx].remove(); + this._tableContainers.splice(tableIdx, 1); //Update View Structure } this.repaint = function($container) {