Kurt001
3 May 2011, 2:41 PM
Hi there,
I am looking for a way to get a nested list filled with a JSONP.request.
So far I have:
var myJRequest = function() {
Ext.util.JSONP.request({
url: 'http://thisWebID/configuration',
callbackKey: 'jsoncallback',
params: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
callback: function(result) {
console.log(result)
}
});
}; This works fine. It calls the server with
http://thisWebID/configuration?format=json&jsoncallback=Ext.util.JSONP.callbackNow I would like to fill a nested list with the data from the callback.
Ext.setup({
onReady : function() {
// store with data
Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'scripttag',
url : 'http://thisWebID/configuration',
callbackParam: 'jsoncallback',
extraParams: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
reader: {
type: 'tree',
root: 'configuration'
}
}
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'NestedList',
displayField: 'text',
store: store
});
}
});Now the following is added to the call:
http://thisWebID/configuration?format=json&jsoncallback=Ext.util.JSONP.callback,stcCallback1001But as the JSONP result seems to be ok, the only problem is, that the nested list keeps telling me that No Items Available
This is my result from the JSONP call:
Ext.util.JSONP.callback,stcCallback1001({ configuration":{"data-types":{"data-type":[{"@name":"Quantity","@id":"1","@unit":"1"},{"@name":"Weight","@id":"2","@unit":"kg"}],"attributes":[{"@name":"Attribute","@id":"4"},{"@name":"RawData","@id":"655"},{"@name":"RawData2","@id":"656"}]},"device-types":{"device-type":[{"@name":"Holder","@id":"5","data-streams":{"data-stream":[{"@name":"Offer","@id":"6","@data-type":"Attribute"},{"@name":"Mapping","@id":"7","@data-type":"Attribute"},]},"sources":{"source":{"@name":"Post","@id":"13","data-streams":{"data-stream":[{"@name":"Offer","@id":"14"},{"@name":"Mapping","@id":"15"},]}}}}]}}})How can I populate a nested list with JSONP?
Best regards
Kurt
I am looking for a way to get a nested list filled with a JSONP.request.
So far I have:
var myJRequest = function() {
Ext.util.JSONP.request({
url: 'http://thisWebID/configuration',
callbackKey: 'jsoncallback',
params: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
callback: function(result) {
console.log(result)
}
});
}; This works fine. It calls the server with
http://thisWebID/configuration?format=json&jsoncallback=Ext.util.JSONP.callbackNow I would like to fill a nested list with the data from the callback.
Ext.setup({
onReady : function() {
// store with data
Ext.regModel('ListItem', {
fields: [{name: 'text', type: 'string'}]
});
var store = new Ext.data.TreeStore({
model: 'ListItem',
proxy: {
type: 'scripttag',
url : 'http://thisWebID/configuration',
callbackParam: 'jsoncallback',
extraParams: { format: 'json', jsoncallback: 'Ext.util.JSONP.callback' },
reader: {
type: 'tree',
root: 'configuration'
}
}
});
var nestedList = new Ext.NestedList({
fullscreen: true,
title: 'NestedList',
displayField: 'text',
store: store
});
}
});Now the following is added to the call:
http://thisWebID/configuration?format=json&jsoncallback=Ext.util.JSONP.callback,stcCallback1001But as the JSONP result seems to be ok, the only problem is, that the nested list keeps telling me that No Items Available
This is my result from the JSONP call:
Ext.util.JSONP.callback,stcCallback1001({ configuration":{"data-types":{"data-type":[{"@name":"Quantity","@id":"1","@unit":"1"},{"@name":"Weight","@id":"2","@unit":"kg"}],"attributes":[{"@name":"Attribute","@id":"4"},{"@name":"RawData","@id":"655"},{"@name":"RawData2","@id":"656"}]},"device-types":{"device-type":[{"@name":"Holder","@id":"5","data-streams":{"data-stream":[{"@name":"Offer","@id":"6","@data-type":"Attribute"},{"@name":"Mapping","@id":"7","@data-type":"Attribute"},]},"sources":{"source":{"@name":"Post","@id":"13","data-streams":{"data-stream":[{"@name":"Offer","@id":"14"},{"@name":"Mapping","@id":"15"},]}}}}]}}})How can I populate a nested list with JSONP?
Best regards
Kurt