details:   https://code.openbravo.com/erp/devel/pi/rev/125620fe071d
changeset: 22849:125620fe071d
user:      Augusto Mauch <augusto.mauch <at> openbravo.com>
date:      Wed Apr 09 16:33:20 2014 +0200
summary:   Fixes issue 26228: Date and datetime fields are not shown in the 
tree grid view

The problem was that in the tree grid view the applyCellTypeFormatters was 
being called passing the date value as a string, when that function expects a 
date object. This has been solved by detecting this case and converting the 
value from string to date before calling applyCellTypeFormatters.

diffstat:

 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js
 |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (19 lines):

diff -r 075221192871 -r 125620fe071d 
modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js
--- 
a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js
     Wed Apr 09 15:13:33 2014 +0200
+++ 
b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-tree-grid.js
     Wed Apr 09 16:33:20 2014 +0200
@@ -139,5 +139,14 @@
   // No actions should be triggered when clicking a record with the right 
button
   cellContextClick: function (record, rowNum, colNum) {
     return false;
+  },
+
+  applyCellTypeFormatters: function (value, record, field, rowNum, colNum, 
isMultipleElement) {
+    if (field.type === '_id_16' && value && !isc.isA.Date(value) && 
isc.isA.Date(Date.parseSchemaDate(value))) {
+      // applyCellTypeFormatters expects a date as value if the field is a date
+      // if the original value is not a date, convert it to date before 
calling applyCellTypeFormatters
+      value = Date.parseSchemaDate(value);
+    }
+    return this.Super('applyCellTypeFormatters', [value, record, field, 
rowNum, colNum, isMultipleElement]);
   }
 });
\ No newline at end of file

------------------------------------------------------------------------------
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to