details:   /erp/devel/pi/rev/8db66b8fe082
changeset: 9838:8db66b8fe082
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 16:58:30 2011 +0100
summary:   Improved scrolling and focus behavior for section item

details:   /erp/devel/pi/rev/43b9ea3ec34b
changeset: 9839:43b9ea3ec34b
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 16:58:51 2011 +0100
summary:   Improved selection behavior in grid

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
 |  35 ++++-----
 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
              |  36 +--------
 2 files changed, 22 insertions(+), 49 deletions(-)

diffs (124 lines):

diff -r 9e68ccd58000 -r 43b9ea3ec34b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
     Sat Jan 15 16:56:14 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-form-linked-items.js
     Sat Jan 15 16:58:51 2011 +0100
@@ -26,11 +26,14 @@
 isc.OBLinkedItemSectionItem.addProperties({
   // as the name is always the same there should be at most 
   // one linked item section per form
-  name: '_linkedItem_',
+  name: '_linkedItems_',
   
-  width: '100%',
-  height: '100%',
+  // note: setting these apparently completely hides the section
+  //width: '100%',
+  //height: '100%',
+  
   overflow: 'hidden',
+  
   canFocus: true,
   
   // don't expand as a default
@@ -73,18 +76,6 @@
   expandSection: function(){
     var ret = this.Super('expandSection', arguments);
     this.getLinkedItemPart().setExpanded(true);
-    
-    // after doing the linked item section check if this 
-    // can replace the scrollto below
-    //    this.canvasItem.focusInItem();
-    
-    // NOTE: if the layout structure changes then this needs to be 
-    // changed probably to see where the scrollbar is to scroll
-    
-    // call with a small delay to let the item be expanded
-    // form.parentElement is the one holding the scrollbar apparently
-    this.form.parentElement.delayCall('scrollToBottom', null, 200);
-    
     return ret;
   },
   
@@ -101,8 +92,10 @@
   // set to true when the content has been created at first expand
   isInitialized: false,
   
-  width: '100%',
-  height: '100%',
+  // setting width/height makes the canvasitem to be hidden after a few
+  // clicks on the section item, so don't do that for now
+//  width: '100%',
+//  height: '100%',
   
   initWidget: function(){
     var ret = this.Super('initWidget', arguments);
@@ -171,8 +164,12 @@
 
 isc.OBLinkedItemCanvasItem.addProperties({
 
-  width: '100%',
-  height: '100%',
+  canFocus: true,
+  
+  // setting width/height makes the canvasitem to be hidden after a few
+  // clicks on the section item, so don't do that for now
+  //width: '100%',
+  //height: '100%',
   
   showTitle: false,
   overflow: 'auto',
diff -r 9e68ccd58000 -r 43b9ea3ec34b 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Sat Jan 15 16:56:14 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-view-grid.js
  Sat Jan 15 16:58:51 2011 +0100
@@ -577,46 +577,22 @@
     }
   },
   
-  // selectionChanged is called when the user makes changes
-  selectionChanged: function(record, state){
+  selectionUpdated: function(record, recordList){
   
     this.stopHover();
-    
-    // enable/disable the delete if there are records selected
-    this.view.toolBar.setLeftMemberDisabled(isc.OBToolbar.TYPE_DELETE, 
(!this.getSelection() || this.getSelection().length === 0));
+    this.updateSelectedCountDisplay();
     
     // nothing changed, go away then, happens when saving
-    if (state && this.view.lastRecordSelected && record && 
this.view.lastRecordSelected.id === record.id) {
+    if (this.singleRecordSelection && this.view.lastRecordSelected && 
this.getSelection().length === 1 && this.getSelection()[0].id === 
this.view.lastRecordSelected.id) {
       // instance may have been updated, update the instance in the view
-      this.view.lastRecordSelected = record;
+      this.view.lastRecordSelected = this.getSelection()[0];
       return;
     }
-    
-    // stop editing if the selection is changing  
-    var rowNum = this.getRecordIndex(record);
-    
-    if (this.getEditRow()) {
-      if (this.getEditRow() !== rowNum) {
-        this.endEditing();
-      } else {
-        // don't do any updates
-        this.updateSelectedCountDisplay();
-        return;
-      }
-    }
-    
-    isc.Log.logDebug('Selection changed ' + state, 'OB');
-    this.updateSelectedCountDisplay();
-    this.view.recordSelected();
-  },
-  
-  // selectionUpdated is called when the grid selection is changed
-  // programmatically
-  selectionUpdated: function(record, recordList){
   
     isc.Log.logDebug('Selection updated ' + record, 'OB');
-    this.updateSelectedCountDisplay();
+
     this.view.recordSelected();
+
     // enable/disable the delete if there are records selected
     this.view.toolBar.setLeftMemberDisabled(isc.OBToolbar.TYPE_DELETE, 
(!this.getSelection() || this.getSelection().length === 0));
   },

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to