Hybrid View
-
19 Dec 2012 3:51 AM #1
Unanswered: Data not coming from jsonp
Unanswered: Data not coming from jsonp
Not able to see any data in this list

Any guess why it is not working
Code:Ext.define("StockWatch.view.MarketList", { extend: "Ext.dataview.List", requires: "Ext.plugin.PullRefresh", xtype: "marketlist", config: { loadingText: "Loading Markets...", layout: 'fit', plugins: [ { xclass: 'Ext.plugin.PullRefresh', } ], store: { fields : ['CompanyCode','LastTradedPrice'], proxy : { type:'jsonp', url:'http://money.rediff.com/money1/current_status_new.php?companylist=17023928%7C17023929&id=1354690151&Rand=0.6305125835351646', callbackKey: 'callbackJsonp', reader: { type: 'json', rootProperty: '' } }, autoLoad:true, }, emptyText: '</pre><div>No markets found.</div><pre>', onItemDisclosure: false, itemTpl: '</pre><div>{CompanyCode}</div><div>{LastTradedPrice}</div><pre>', } });
-
19 Dec 2012 7:19 AM #2
At first glance I see you have some trailing commas sprinkled about in your code. Also, have you reviewed your error console when you run your code? What does that report? Have you verified that your service is returning your callback as expected? Check this stuff out then post more details/information if necessary.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
19 Dec 2012 10:26 AM #3
console has no error, just a warning, the server returned ot as a script but changing it to text/html or some kind of this...
i'm getting this response when i hit url on browser
[{"CompanyCode":"17023928","LastTradedPrice":"19,476.00","Volume":"0","PercentageDiff":"0.57","FiftyTwoWeekHigh":"19,612.18","FiftyTwoWeekLow":"15,135.86","LastTradedTime":"19 Dec,16:00:21","ChangePercent":"0.57","Change":"111.25","MarketCap":"0.00","High":"19,516.02","Low":"19,419.76","PrevClose":"19,364.75","OpenInterest":"","MarketLot":"","ChangeInOpenInterest":"","Symbol":null},{"CompanyCode":"17023929","LastTradedPrice":"5,929.60","Volume":"0","PercentageDiff":"0.56","FiftyTwoWeekHigh":"5,965.15","FiftyTwoWeekLow":"4,588.05","LastTradedTime":"19 Dec,16:27:55","ChangePercent":"0.56","Change":"32.80","MarketCap":"0.00","High":"5,939.40","Low":"5,910.80","PrevClose":"5,896.80","OpenInterest":"","MarketLot":"","ChangeInOpenInterest":"","Symbol":""}]
I dnot know how to check if server is returning a callback thing that u r saying
-
19 Dec 2012 11:49 AM #4
Your json encoded data is not wrapped in a callback function. See the docs for the jsonp proxy here:
http://docs.sencha.com/touch/2-1/#!/...ta.proxy.JsonP
The second code figure in those docs will show you the difference in your data.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.
-
19 Dec 2012 8:59 PM #5
So that means I wont be able to show this data on list??

any way on how to achieve this?
-
19 Dec 2012 9:10 PM #6
You can certainly show that data. You just need to fix what's returned from your jsonp service. The snippet I was referring to in the docs was this:
This snippet demonstrates the data being wrapped in a callback.Code:someCallback({ users: [ { id: 1, name: "Ed Spencer", email: "ed@sencha.com" } ] });
Your proxy has a custom callback key of callbackJsonp. This is telling your service to use the callback name that's defined in the querystring parameter of callbackJsonp. If you inspect the url that's being requested with your proxy you'll see that.
I recommend reading the docs for JsonP proxy very carefully so you can get the concept down.
BriceBrice Mason
Front End Developer
Modus Create
@bricemason
bricemason.com
Sencha Touch Screencasts
Vimeo - Sencha Touch Channel
Github Projects:
Sencha Cordova Builder enables the automatic creation, building, and running of PhoneGap (Cordova) projects with Sencha Touch.
Am I Sencha Touch Ready? checks your system to determine what you need to do to start Sencha Touch development. If you're having trouble getting up and running, try this out.
Sencha Tools Bridge allows Sencha SDK Tools to co-exist with Sencha Cmd on the same system.


Reply With Quote