js/foundation/json_renderer/json_renderer.js in rsence-2.0.0.3.pre vs js/foundation/json_renderer/json_renderer.js in rsence-2.0.0.4.pre

- old
+ new

@@ -21,11 +21,11 @@ ** This class is still in development, so expect more ** features and documentation as it matures. ***/ COMM.JSONRenderer = HClass.extend({ - version: 0.5, + version: 0.6, /** = Description * Renders JSON structured data, see some of the demos for usage examples. * * = Parameters: @@ -143,21 +143,24 @@ // JS Extension block _hasExtension = _dataNode['extend'] !== undefined, _extension = _hasExtension?_dataNode['extend']:null, + // JS Extension block + _hasBind = _dataNode['bind'] !== undefined, + _bind = _hasBind?_dataNode['bind']:null, + // JS Definition block _hasDefinition = _dataNode['define'] !== undefined, _definitions = _hasDefinition?_dataNode['define']:null, // The HView-derived class instance, instance is by default the parent _instance = _parent, i, _subView; - // console.log('className:',_className,' class:',_class); this.scopeDepth ++; this.scopes.push({}); try{ if(_hasDefinition){ if(_definitions instanceof Array){ @@ -187,21 +190,31 @@ _extBlock[_name] = _block; } _class = _class.extend( _extBlock ); } if(_hasOptions){ - if(_options['valueObjId'] !== undefined){ - var _valueObjId = _options['valueObjId']; - _options['valueObj'] = COMM.Values.values[_options['valueObjId']]; + if(_hasBind){ + _options.valueObj = COMM.Values.values[_bind]; } + else{ + if(_options['valueObjId'] !== undefined){ + var _valueObjId = _options['valueObjId']; + _options['valueObj'] = COMM.Values.values[_options['valueObjId']]; + } + } } // For HApplication -derived classes if(!_hasRect && _hasOptions){ _instance = _class.nu(_options); } // For HView and HControl -derived classes else if(_hasRect){ _instance = _class.nu(_rect,_parent,_options); + } + if(!_hasOptions){ + if(_hasBind){ + COMM.Values.values[_bind].bind(_instance); + } } } else if(!(!_class && _hasSubviews)) { console.log('renderNode warning; No such class: '+_className+', node: ',_dataNode); }