[open-ils-commits] r16261 - trunk/Open-ILS/web/js/dojo/openils/widget (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 16 17:09:04 EDT 2010


Author: erickson
Date: 2010-04-16 17:08:58 -0400 (Fri, 16 Apr 2010)
New Revision: 16261

Modified:
   trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
Log:
added ability to stack  multiple EditPane fields into a single EditPane row with a new paneStackDepth param

Modified: trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js	2010-04-16 21:08:57 UTC (rev 16260)
+++ trunk/Open-ILS/web/js/dojo/openils/widget/EditPane.js	2010-04-16 21:08:58 UTC (rev 16261)
@@ -20,6 +20,7 @@
             existingTable : null,
             suppressFields : null,
             requiredFields : null,
+            paneStackCount : 1, // how many fields to add to each row, for compressing display
 
             constructor : function(args) {
                 this.fieldList = [];
@@ -64,6 +65,8 @@
                 if(!this.overrideWidgetArgs)
                     this.overrideWidgetArgs = {};
 
+                var idx = 0;
+                var currentRow;
                 for(var f in this.sortedFieldList) {
                     var field = this.sortedFieldList[f];
                     if(!field || field.virtual || field.nonIdl) continue;
@@ -74,13 +77,26 @@
                     if(field.name == this.fmIDL.pkey && this.mode == 'create' && this.fmIDL.pkey_sequence)
                         continue; /* don't show auto-generated fields on create */
 
-                    var row = document.createElement('tr');
+                    if((idx++ % this.paneStackCount) == 0 || !currentRow) {
+                        // time to start a new row
+                        currentRow = document.createElement('tr');
+                        tbody.appendChild(currentRow);
+                    }
+
                     //var docTd = document.createElement('td');
                     var nameTd = document.createElement('td');
                     var valTd = document.createElement('td');
                     var valSpan = document.createElement('span');
                     valTd.appendChild(valSpan);
+                    dojo.addClass(nameTd, 'openils-widget-editpane-name-cell');
+                    dojo.addClass(valTd, 'openils-widget-editpane-value-cell');
 
+                    if(this.readOnly) {
+                        dojo.addClass(nameTd, 'openils-widget-editpane-ro-name-cell');
+                        dojo.addClass(valTd, 'openils-widget-editpane-ro-value-cell');
+                    }
+
+
                     /*
                     if(this.fieldDocs[field]) {
                         var helpLink = dojo.create('a');
@@ -91,11 +107,10 @@
                     */
 
                     nameTd.appendChild(document.createTextNode(field.label));
-                    row.setAttribute('fmfield', field.name);
-                    //row.appendChild(docTd);
-                    row.appendChild(nameTd);
-                    row.appendChild(valTd);
-                    tbody.appendChild(row);
+                    currentRow.setAttribute('fmfield', field.name);
+                    //currentRow.appendChild(docTd);
+                    currentRow.appendChild(nameTd);
+                    currentRow.appendChild(valTd);
                     //dojo.addClass(docTd, 'oils-fm-edit-pane-help');
 
                     if(!this.overrideWidgetArgs[field.name])



More information about the open-ils-commits mailing list