[open-ils-commits] r14955 - trunk/Open-ILS/xul/staff_client/chrome/content/util (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Nov 18 11:35:52 EST 2009


Author: phasefx
Date: 2009-11-18 11:35:49 -0500 (Wed, 18 Nov 2009)
New Revision: 14955

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
Log:
With fm_columns, hide by default any virtual field and any field with a datatype of link.  For rendering values for link fields, if the data encountered is an object, flatten it by using the field's .key value as a method against the object.

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js	2009-11-18 15:46:06 UTC (rev 14954)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/list.js	2009-11-18 16:35:49 UTC (rev 14955)
@@ -1628,11 +1628,17 @@
                     'id' : col_id,
                     'label' : my_field.label || my_field.name,
                     'sort_type' : [ 'int', 'float', 'id', 'number' ].indexOf(my_field.datatype) > -1 ? 'number' : ( my_field.datatype == 'money' ? 'money' : 'default'),
-                    'hidden' : [ 'isnew', 'ischanged', 'isdeleted' ].indexOf(my_field.name) > -1,
+                    'hidden' : my_field.virtual || my_field.datatype == 'link',
                     'flex' : 1
                 };                    
                 // my_field.datatype => bool float id int interval link money number org_unit text timestamp
-                def.render = function(my) { return my[hint][my_field.name](); }
+                if (my_field.datatype == 'link') {
+                    def.render = function(my) { 
+                        return typeof my[hint][my_field.name]() == 'object' ? my[hint][my_field.name]()[my_field.key]() : my[hint][my_field.name](); 
+                    }
+                } else {
+                    def.render = function(my) { return my[hint][my_field.name](); }
+                }
                 if (my_field.datatype == 'timestamp') {
                     dojo.require('dojo.date.locale');
                     dojo.require('dojo.date.stamp');



More information about the open-ils-commits mailing list