roojs-core.js
authoredward <edward@roojs.com>
Tue, 5 Jan 2016 06:26:03 +0000 (14:26 +0800)
committeredward <edward@roojs.com>
Tue, 5 Jan 2016 06:26:03 +0000 (14:26 +0800)
roojs-core-debug.js
roojs-ui.js
roojs-ui-debug.js
roojs-all.js
roojs-debug.js

roojs-all.js
roojs-debug.js
roojs-ui-debug.js
roojs-ui.js

index 97978de..b7e8678 100644 (file)
@@ -1216,7 +1216,7 @@ Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSe
 Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,"afterselectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true});Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this);}else {this.grid.on("rowclick",this.handleDragableRowClick,this);}
 this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
 this.fireEvent("afterselectionchange",this);},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
-this.fireEvent("afterselectionchange",this);},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);}else {s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.dataSource;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.dataSource.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.dataSource.getCount()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},clearSelections:function(A){if(this.locked)return;if(A!==true){var ds=this.grid.dataSource;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else {this.selections.clear();}
+this.fireEvent("afterselectionchange",this);},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);s.add(ds.getAt(i));}else {s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.dataSource;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.dataSource.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.dataSource.getCount()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},clearSelections:function(A){if(this.locked)return;if(A!==true){var ds=this.grid.dataSource;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else {this.selections.clear();}
 this.last=false;},selectAll:function(){if(this.locked)return;this.selections.clear();for(var i=0,A=this.grid.dataSource.getCount();i<A;i++){this.selectRow(i,true);}},hasSelection:function(){return this.selections.length>0;},isSelected:function(A){var r=typeof A=="number"?this.grid.dataSource.getAt(A):A;return (r&&this.selections.key(r.id)?true:false);},isIdSelected:function(id){return (this.selections.key(id)?true:false);},handleMouseDown:function(e,t){var A=this.grid.getView(),B;if(this.isLocked()||(B=A.findRowIndex(t))===false){return;};if(e.shiftKey&&this.last!==false){var C=this.last;this.selectRange(C,B,e.ctrlKey);this.last=C;A.focusRow(B);}else {var D=this.isSelected(B);if(e.button!==0&&D){A.focusRow(B);}else if(e.ctrlKey&&D){this.deselectRow(B);}else if(!D){this.selectRow(B,e.button===0&&(e.ctrlKey||e.shiftKey));A.focusRow(B);}}
 this.fireEvent("afterselectionchange",this);},handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);A.view.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();}for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked)return;if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else {for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked)return;for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.dataSource.getCount()))return;if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.dataSource.getAt(A);this.selections.add(r);this.last=this.lastActive=A;if(!C){this.grid.getView().onRowSelect(A);}
 this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked)return;if(this.last==A){this.last=false;}if(this.lastActive==A){this.lastActive=false;}var r=this.grid.dataSource.getAt(A);this.selections.remove(r);if(!B){this.grid.getView().onRowDeselect(A);}
index af20359..66e5158 100644 (file)
@@ -55916,6 +55916,7 @@ Roo.extend(Roo.grid.RowSelectionModel, Roo.grid.AbstractSelectionModel,  {
         s.each(function(r){
             if((i = ds.indexOfId(r.id)) != -1){
                 v.onRowSelect(i);
+                s.add(ds.getAt(i)); // updating the selection relate data
             }else{
                 s.remove(r);
             }
index 15f1332..f51d126 100644 (file)
@@ -39470,6 +39470,7 @@ Roo.extend(Roo.grid.RowSelectionModel, Roo.grid.AbstractSelectionModel,  {
         s.each(function(r){
             if((i = ds.indexOfId(r.id)) != -1){
                 v.onRowSelect(i);
+                s.add(ds.getAt(i)); // updating the selection relate data
             }else{
                 s.remove(r);
             }
index c4ab55a..458d8a1 100644 (file)
@@ -881,7 +881,7 @@ Roo.grid.AbstractSelectionModel=function(){this.locked=false;Roo.grid.AbstractSe
 Roo.grid.RowSelectionModel=function(A){Roo.apply(this,A);this.selections=new Roo.util.MixedCollection(false,function(o){return o.id;});this.last=false;this.lastActive=false;this.addEvents({"selectionchange":true,"afterselectionchange":true,"beforerowselect":true,"rowselect":true,"rowdeselect":true});Roo.grid.RowSelectionModel.superclass.constructor.call(this);this.locked=false;};Roo.extend(Roo.grid.RowSelectionModel,Roo.grid.AbstractSelectionModel,{singleSelect:false,initEvents:function(){if(!this.grid.enableDragDrop&&!this.grid.enableDrag){this.grid.on("mousedown",this.handleMouseDown,this);}else {this.grid.on("rowclick",this.handleDragableRowClick,this);}
 this.rowNav=new Roo.KeyNav(this.grid.getGridEl(),{"up":function(e){if(!e.shiftKey){this.selectPrevious(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive-1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
 this.fireEvent("afterselectionchange",this);},"down":function(e){if(!e.shiftKey){this.selectNext(e.shiftKey);}else if(this.last!==false&&this.lastActive!==false){var B=this.last;this.selectRange(this.last,this.lastActive+1);this.grid.getView().focusRow(this.lastActive);if(B!==false){this.last=B;}}else {this.selectFirstRow();}
-this.fireEvent("afterselectionchange",this);},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);}else {s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.dataSource;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.dataSource.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.dataSource.getCount()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},clearSelections:function(A){if(this.locked)return;if(A!==true){var ds=this.grid.dataSource;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else {this.selections.clear();}
+this.fireEvent("afterselectionchange",this);},scope:this});var A=this.grid.view;A.on("refresh",this.onRefresh,this);A.on("rowupdated",this.onRowUpdated,this);A.on("rowremoved",this.onRemove,this);},onRefresh:function(){var ds=this.grid.dataSource,i,v=this.grid.view;var s=this.selections;s.each(function(r){if((i=ds.indexOfId(r.id))!=-1){v.onRowSelect(i);s.add(ds.getAt(i));}else {s.remove(r);}});},onRemove:function(v,A,r){this.selections.remove(r);},onRowUpdated:function(v,A,r){if(this.isSelected(r)){v.onRowSelect(A);}},selectRecords:function(A,B){if(!B){this.clearSelections();}var ds=this.grid.dataSource;for(var i=0,C=A.length;i<C;i++){this.selectRow(ds.indexOf(A[i]),true);}},getCount:function(){return this.selections.length;},selectFirstRow:function(){this.selectRow(0);},selectLastRow:function(A){this.selectRow(this.grid.dataSource.getCount()-1,A);},selectNext:function(A){if(this.last!==false&&(this.last+1)<this.grid.dataSource.getCount()){this.selectRow(this.last+1,A);this.grid.getView().focusRow(this.last);}},selectPrevious:function(A){if(this.last){this.selectRow(this.last-1,A);this.grid.getView().focusRow(this.last);}},getSelections:function(){return [].concat(this.selections.items);},getSelected:function(){return this.selections.itemAt(0);},clearSelections:function(A){if(this.locked)return;if(A!==true){var ds=this.grid.dataSource;var s=this.selections;s.each(function(r){this.deselectRow(ds.indexOfId(r.id));},this);s.clear();}else {this.selections.clear();}
 this.last=false;},selectAll:function(){if(this.locked)return;this.selections.clear();for(var i=0,A=this.grid.dataSource.getCount();i<A;i++){this.selectRow(i,true);}},hasSelection:function(){return this.selections.length>0;},isSelected:function(A){var r=typeof A=="number"?this.grid.dataSource.getAt(A):A;return (r&&this.selections.key(r.id)?true:false);},isIdSelected:function(id){return (this.selections.key(id)?true:false);},handleMouseDown:function(e,t){var A=this.grid.getView(),B;if(this.isLocked()||(B=A.findRowIndex(t))===false){return;};if(e.shiftKey&&this.last!==false){var C=this.last;this.selectRange(C,B,e.ctrlKey);this.last=C;A.focusRow(B);}else {var D=this.isSelected(B);if(e.button!==0&&D){A.focusRow(B);}else if(e.ctrlKey&&D){this.deselectRow(B);}else if(!D){this.selectRow(B,e.button===0&&(e.ctrlKey||e.shiftKey));A.focusRow(B);}}
 this.fireEvent("afterselectionchange",this);},handleDragableRowClick:function(A,B,e){if(e.button===0&&!e.shiftKey&&!e.ctrlKey){this.selectRow(B,false);A.view.focusRow(B);this.fireEvent("afterselectionchange",this);}},selectRows:function(A,B){if(!B){this.clearSelections();}for(var i=0,C=A.length;i<C;i++){this.selectRow(A[i],true);}},selectRange:function(A,B,C){if(this.locked)return;if(!C){this.clearSelections();}if(A<=B){for(var i=A;i<=B;i++){this.selectRow(i,true);}}else {for(var i=A;i>=B;i--){this.selectRow(i,true);}}},deselectRange:function(A,B,C){if(this.locked)return;for(var i=A;i<=B;i++){this.deselectRow(i,C);}},selectRow:function(A,B,C){if(this.locked||(A<0||A>=this.grid.dataSource.getCount()))return;if(this.fireEvent("beforerowselect",this,A,B)!==false){if(!B||this.singleSelect){this.clearSelections();}var r=this.grid.dataSource.getAt(A);this.selections.add(r);this.last=this.lastActive=A;if(!C){this.grid.getView().onRowSelect(A);}
 this.fireEvent("rowselect",this,A,r);this.fireEvent("selectionchange",this);}},deselectRow:function(A,B){if(this.locked)return;if(this.last==A){this.last=false;}if(this.lastActive==A){this.lastActive=false;}var r=this.grid.dataSource.getAt(A);this.selections.remove(r);if(!B){this.grid.getView().onRowDeselect(A);}