Permalink
Browse files

Fixed tab panel render strategy bug

  • Loading branch information...
1 parent f467653 commit fa54ddabe9435fd2164996c0cbfdd461202dc8e6 Ed Spencer committed Sep 17, 2009
Showing with 51 additions and 17 deletions.
  1. +11 −3 controller/Controller.js
  2. +1 −1 ext-mvc-all-min.js
  3. +25 −8 ext-mvc-all.js
  4. +14 −5 view/scaffold/Index.js
View
@@ -253,9 +253,17 @@ ExtMVC.registerController('controller', {
* The tabpanel render strategy
*/
tabPanelRenderStrategy: function(container, view) {
- container.add(view);
- container.doLayout();
- container.activate(view);
+ var existing = container.getItem(view.id);
+
+ //don't add a tab with the same id as an existing one
+ if (existing == undefined) {
+ container.add(view);
+ container.doLayout();
+ container.activate(view);
+ } else {
+ container.setActiveTab(view.id);
+ view.destroy();
+ }
},
/**
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -2827,9 +2827,17 @@ ExtMVC.registerController('controller', {
* The tabpanel render strategy
*/
tabPanelRenderStrategy: function(container, view) {
- container.add(view);
- container.doLayout();
- container.activate(view);
+ var existing = container.getItem(view.id);
+
+ //don't add a tab with the same id as an existing one
+ if (existing == undefined) {
+ container.add(view);
+ container.doLayout();
+ container.activate(view);
+ } else {
+ container.setActiveTab(view.id);
+ view.destroy();
+ }
},
/**
@@ -5721,7 +5729,14 @@ ExtMVC.registerView('scaffold', 'index', {
viewConfig: { forceFit: true },
id: String.format("{0}_index", this.model.prototype.tableName),
- loadMask: true
+ loadMask: true,
+
+ /**
+ * @property dblClickToEdit
+ * @type Boolean
+ * True to edit a record when it is double clicked (defaults to true)
+ */
+ dblClickToEdit: true
});
Ext.grid.GridPanel.prototype.constructor.call(this, config);
@@ -5794,10 +5809,12 @@ ExtMVC.registerView('scaffold', 'index', {
* Mostly, this is simply a case of capturing events received and re-emitting normalized events
*/
initListeners: function() {
- this.on({
- scope : this,
- 'dblclick': this.onEdit
- });
+ if (this.dblClickToEdit === true) {
+ this.on({
+ scope : this,
+ 'rowdblclick': this.onEdit
+ });
+ }
if (this.controller != undefined) {
this.controller.on('delete', this.refreshStore, this);
View
@@ -27,7 +27,14 @@ ExtMVC.registerView('scaffold', 'index', {
viewConfig: { forceFit: true },
id: String.format("{0}_index", this.model.prototype.tableName),
- loadMask: true
+ loadMask: true,
+
+ /**
+ * @property dblClickToEdit
+ * @type Boolean
+ * True to edit a record when it is double clicked (defaults to true)
+ */
+ dblClickToEdit: true
});
Ext.grid.GridPanel.prototype.constructor.call(this, config);
@@ -100,10 +107,12 @@ ExtMVC.registerView('scaffold', 'index', {
* Mostly, this is simply a case of capturing events received and re-emitting normalized events
*/
initListeners: function() {
- this.on({
- scope : this,
- 'dblclick': this.onEdit
- });
+ if (this.dblClickToEdit === true) {
+ this.on({
+ scope : this,
+ 'rowdblclick': this.onEdit
+ });
+ }
if (this.controller != undefined) {
this.controller.on('delete', this.refreshStore, this);

0 comments on commit fa54dda

Please sign in to comment.