[open-ils-commits] r11505 - trunk/Open-ILS/web/js/dojo/fieldmapper
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 11 10:33:00 EST 2008
Author: erickson
Date: 2008-12-11 10:32:58 -0500 (Thu, 11 Dec 2008)
New Revision: 11505
Modified:
trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
Log:
added methods to allow for initializing a store and turning single objects into store data
Modified: trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2008-12-10 19:27:32 UTC (rev 11504)
+++ trunk/Open-ILS/web/js/dojo/fieldmapper/dojoData.js 2008-12-11 15:32:58 UTC (rev 11505)
@@ -36,18 +36,23 @@
return this;
}
- function _toStoreData (list, label, params) {
-
+ function _initStoreData(label, params) {
if (!params) params = {};
- if (!list) list = {};
-
- // a sane default
if (!params.identifier) params.identifier = this.Identifier;
if (!label) label = params.label;
if (!label) label = params.identifier;
+ return { label : label, identifier : params.identifier, items : [] };
+ }
- var data = { label : label, identifier : params.identifier, items : [] };
+ function _itemToStoreData(fmObj, params) {
+ if (!params) params = {};
+ return fmObj.toHash(true, params.virtualFields);
+ }
+ function _toStoreData (list, label, params) {
+ if (!params) params = {};
+ var data = this.initStoreData(label, params);
+
for (var i in list) data.items.push( list[i].toHash(true, params.virtualFields) );
if (params.children && params.parent) {
@@ -89,6 +94,8 @@
for (var i in fmclasses) fieldmapper[i].prototype.fromStoreItem = _fromStoreItem;
for (var i in fmclasses) fieldmapper[i].toStoreData = _toStoreData;
+ for (var i in fmclasses) fieldmapper[i].itemToStoreData = _itemToStoreData;
+ for (var i in fmclasses) fieldmapper[i].initStoreData = _initStoreData;
fieldmapper.aou.prototype._ignore_fields = ['children'];
fieldmapper.aout.prototype._ignore_fields = ['children'];
More information about the open-ils-commits
mailing list