diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js index c4df562b37a71fa6b079b319433933ffa43b076c..3f09cf7725937b77657ce2ab3eae574c825c61c0 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageController.js @@ -24,6 +24,15 @@ function StorageController(configOverride) { if(this._storageModel.config.boxSelector === "on") { this._gridController.getView().setLabelClickedEventHandler(function(posX, posY, label) { + // + // Delete old state in model and view + // + _this._storageModel.resetBoxInfo(); + + + // + // Set new sate in model and view + // _this._storageModel.row = posX; _this._storageModel.column = posY; _this._storageModel.boxName = label; @@ -41,15 +50,32 @@ function StorageController(configOverride) { if(this._storageModel.config.rackSelector === "on") { this._gridController.getView().setPosClickedEventHandler(function(posX, posY) { + // + // Delete old state in model and view + // + _this._storageModel.resetBoxInfo(); + if(_this._storageModel.config.contentsSelector === "on") { + _this._storageView.showContents([]); + } + + // + // Set new sate in model and view + // _this._storageModel.row = posX; _this._storageModel.column = posY; - _this._storageModel.boxName = ""; _this._storageView.getBoxField().val(""); _this._storageView.getBoxField().removeAttr("disabled"); _this._storageView.getBoxField().show(); }); } + + if(this._storageModel.config.contentsSelector === "on") { + this._storageView.getBoxContentsDropDown().change(function() { + var selectedSamples = $(this).val(); + _this._storageModel.boxContents = selectedSamples; + }); + } this._storageView.getBoxField().keyup(function() { _this._storageModel.boxName = $(this).val(); @@ -65,7 +91,14 @@ function StorageController(configOverride) { this._storageView.getSelectStorageDropdown().change(function(event) { _this._storageView.getBoxField().hide(); + // + // Delete old state in model and view + // _this._storageModel.resetBoxInfo(); + if(_this._storageModel.config.contentsSelector === "on") { + _this._storageView.showContents([]); + } + // // Obtain Storage Configuration // diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js index 0ca0bf2790878147f3bfcedbfeab6bb1986deb49..8136ad4ab8d10e2c8ad52c9f6d94e36d482ba833 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageModel.js @@ -34,13 +34,13 @@ function StorageModel(configOverride) { this.userId = null; //Selected user Being filtered (creator or latest modifier of the box) this.row = null; //Selected Row this.column = null; //Selected Column - this.boxName = //Selected Box + this.boxName = null; //Selected Box this.boxContents = null; //Selected Box contents (samples) this.resetBoxInfo = function() { this.row = null; //Selected Row this.column = null; //Selected Column - this.boxName = //Selected Box + this.boxName = null; //Selected Box this.boxContents = null; //Selected Box contents (samples) } } \ No newline at end of file diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js index 8df90e29eadc5235c158ab40e276841905d7ae9d..f3ac76394e430d5b3cbfe22de1ac9c618727e324 100644 --- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js +++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/StorageManager/widgets/StorageView.js @@ -23,7 +23,7 @@ function StorageView(storageModel, gridView) { this._userIdFilter = FormUtil._getInputField("text", "", "User id to filter", null, false); this._gridContainer = $("<div>"); this._boxField = FormUtil._getInputField("text", "", "Box Name", null, false); - this._contentsContainer = $("<div>"); + this._boxContentsDropDown = $('<select>', { 'id' : 'boxSamplesSelector' , class : 'multiselect' , 'multiple' : 'multiple'}); this.repaint = function($container) { var _this = this; @@ -55,21 +55,18 @@ function StorageView(storageModel, gridView) { } if(this._storageModel.config.contentsSelector === "on") { - var $controlGroupBoxContents = FormUtil.getFieldForComponentWithLabel(this._contentsContainer, "Box Contents"); + var $controlGroupBoxContents = FormUtil.getFieldForComponentWithLabel(this._boxContentsDropDown, "Box Contents"); $container.append($controlGroupBoxContents); + this._boxContentsDropDown.multiselect(); } } this.showContents = function(contents) { - this._contentsContainer.empty(); - - var $contentsDropDown = $('<select>', { 'id' : 'boxSamplesSelector' , class : 'multiselect' , 'multiple' : 'multiple'}); + this._boxContentsDropDown.empty(); for (var i = 0; i < contents.length; i++) { - $contentsDropDown.append($('<option>', { 'value' : contents[i].code , 'selected' : ''}).html(contents[i].code)); + this._boxContentsDropDown.append($('<option>', { 'value' : contents[i].code , 'selected' : ''}).html(contents[i].code)); } - - this._contentsContainer.append($contentsDropDown); - $('#boxSamplesSelector').multiselect(); + this._boxContentsDropDown.multiselect('rebuild'); } // @@ -94,4 +91,8 @@ function StorageView(storageModel, gridView) { this.getBoxField = function() { return this._boxField; } + + this.getBoxContentsDropDown = function() { + return this._boxContentsDropDown; + } } \ No newline at end of file