projects
/
roojs1
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove debugging code
[roojs1]
/
Roo
/
JsonView.js
diff --git
a/Roo/JsonView.js
b/Roo/JsonView.js
index
2e8bffb
..
4d9513c
100644
(file)
--- a/
Roo/JsonView.js
+++ b/
Roo/JsonView.js
@@
-16,7
+16,7
@@
<pre><code>
var view = new Roo.JsonView({
container: "my-element",
<pre><code>
var view = new Roo.JsonView({
container: "my-element",
- t
emplate
: '<div id="{id}">{foo} - {bar}</div>', // auto create template
+ t
pl
: '<div id="{id}">{foo} - {bar}</div>', // auto create template
multiSelect: true,
jsonRoot: "data"
});
multiSelect: true,
jsonRoot: "data"
});
@@
-50,6
+50,7
@@
moreView.load({
});
</code></pre>
*
});
</code></pre>
*
+* Note: old code is supported with arguments : (container, template, config)
*
*
* @constructor
*
*
* @constructor
@@
-58,10
+59,10
@@
moreView.load({
* @param {Object} config The config object
*
*/
* @param {Object} config The config object
*
*/
-Roo.JsonView = function(con
tainer, tpl,
config){
+Roo.JsonView = function(con
fig, depreciated_tpl, depreciated_
config){
- Roo.JsonView.superclass.constructor.call(this, con
tainer, tpl,
config);
+ Roo.JsonView.superclass.constructor.call(this, con
fig, depreciated_tpl, depreciated_
config);
var um = this.el.getUpdateManager();
um.setRenderer(this);
var um = this.el.getUpdateManager();
um.setRenderer(this);
@@
-95,8
+96,7
@@
Roo.JsonView = function(container, tpl, config){
};
Roo.extend(Roo.JsonView, Roo.View, {
/**
};
Roo.extend(Roo.JsonView, Roo.View, {
/**
- * The root property in the loaded JSON object that contains the data
- * @type {String}
+ * @type {String} The root property in the loaded JSON object that contains the data
*/
jsonRoot : "",
*/
jsonRoot : "",
@@
-148,15
+148,20
@@
Roo.extend(Roo.JsonView, Roo.View, {
um.update.apply(um, arguments);
},
um.update.apply(um, arguments);
},
+ // note - render is a standard framework call...
+ // using it for the response is really flaky... - it's called by UpdateManager normally, except when called by the XComponent/addXtype.
render : function(el, response){
render : function(el, response){
+
this.clearSelections();
this.el.update("");
var o;
try{
this.clearSelections();
this.el.update("");
var o;
try{
- o = Roo.util.JSON.decode(response.responseText);
- if(this.jsonRoot){
-
- o = /** eval:var:o */ eval("o." + this.jsonRoot);
+ if (response != '') {
+ o = Roo.util.JSON.decode(response.responseText);
+ if(this.jsonRoot){
+
+ o = o[this.jsonRoot];
+ }
}
} catch(e){
}
}
} catch(e){
}