details:   /erp/devel/pi/rev/9e68ccd58000
changeset: 9837:9e68ccd58000
user:      Martin Taal <martin.taal <at> openbravo.com>
date:      Sat Jan 15 16:56:14 2011 +0100
summary:   Added scrollto of expanded sections, set first day of week in 
datechooser

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
 |  45 +++++++++-
 1 files changed, 42 insertions(+), 3 deletions(-)

diffs (77 lines):

diff -r 64209940bdbd -r 9e68ccd58000 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Sat Jan 15 16:55:16 2011 +0100
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/ob-formitem-widgets.js
   Sat Jan 15 16:56:14 2011 +0100
@@ -94,7 +94,7 @@
 isc.OBSearchItem.addProperties({
   showPickerIcon: true,
   canFocus: true,
-
+  
   setValue: function(value){
     var ret = this.Super('setValue', arguments);
     // in this case the clearIcon needs to be shown or hidden
@@ -302,7 +302,46 @@
   // never disable a section item
   isDisabled: function(){
     return false;
+  },
+  
+  collapseSection: function(){
+    // when collapsing set the focus to the header
+    this.form.setFocusItem(this);
+    var ret = this.Super('collapseSection', arguments);
+    return ret;
+  },
+  
+  expandSection: function(){
+    var ret = this.Super('expandSection', arguments);
+    
+    // when expanding set the focus to the first focusable item     
+    // set focus with a short delay to give the section time to draw
+    this.delayCall("setNewFocusItemExpanding", [], 100);
+    
+    // NOTE: if the layout structure changes then this needs to be 
+    // changed probably to see where the scrollbar is to scroll
+    // the parentElement is not set initially when drawing
+    if (this.form.parentElement) {
+      // scroll after things have been expanded
+      this.form.parentElement.delayCall('scrollTo', [null, this.getTop()], 
100);    
+    }
+
+    return ret;
+  },
+    
+  setNewFocusItemExpanding: function(){
+    var newFocusItem = this;
+    for (var i = 0; i < this.itemIds.length; i++) {
+      var itemName = this.itemIds[i], item = this.form.getItem(itemName);
+      // isFocusable is a method added in ob-smartclient.js
+      if (item.isFocusable()) {
+        newFocusItem = item;
+        break;
+      }
+    }
+    newFocusItem.focusInItem();
   }
+  
 });
 
 // == OBListItem ==
@@ -429,7 +468,7 @@
 isc.ClassFactory.defineClass('OBDateChooser', DateChooser);
 
 isc.OBDateChooser.addProperties({
-  firstDayOfWeek: 1  
+  firstDayOfWeek: 1
 });
 
 // == OBDateItem ==
@@ -623,7 +662,7 @@
   // ** {{{ pickerConstructor }}} **
   // Picker constructor class
   pickerConstructor: 'OBDateChooser',
-
+  
   // ** {{{ dateFormat }}} **
   // Dateformat function
   dateFormat: OB.Format.date,

------------------------------------------------------------------------------
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