1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    60
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default Local JSON file reading.

    Local JSON file reading.


    Hi,

    Have been trying to read local JSON file (used chrome option --allow-file-access-from-files ) into a store. This used to work pretty well in 1.x. Now in SENCHA TOUCH 2.0 it works only if we deploy on webbrowser but not when we access directly using file://<index.html>

    Is there any solution for the same.

    I have tried my own code as well some samples like "FrancisShanahan-SenchaTouch2MVCHelloworld-c330be1" --

    ** This does impact if we use phonegap to compile the code and try on iPad.

    Thanks and Regards
    Sarang

  2. #2
    Sencha User
    Join Date
    Sep 2010
    Location
    Netherlands
    Posts
    120
    Vote Rating
    4
    aacoro is on a distinguished road

      0  

    Default


    relative paths doe not work for you? Like:
    Code:
    ../../data.json

  3. #3
    Sencha - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    Do you mean in the browser, or PhoneGap? This should work- I've done it several times.

    Could you provide a simple testcase so we can look into it?
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.

  4. #4
    Sencha User
    Join Date
    Aug 2011
    Posts
    60
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default


    I had just downloaded FrancisShanahan-SenchaTouch2MVCHelloworld-c330be1 from https://github.com/FrancisShanahan/S...2MVCHelloworld and copied to the following directory

    C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Frank

    When i use file:///C:/Program%20Files/Apache%20...ank/index.html in CHROME

    The second carousel panle which is supposed to show list item DOES NOT SHOW any items. I checked in javascript console -- no error. Also checked the store element and data is empty. Tried using javascript console to load but result is same


    When I use http::/localhost/frank/index.html -- everything works perfect (basically apache is running)

    THanks and Regards
    Sarang

  5. #5
    Sencha User
    Join Date
    Aug 2011
    Posts
    60
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default


    Any update please ?

    When I directly use (file:// -- without webserver), and set breakpoint on callback this is what I have

    records :null
    success :false
    operation : full details

    Thanks and Regards
    Sarang

  6. #6
    Sencha User
    Join Date
    Aug 2011
    Posts
    60
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default


    On tracing this is what we get

    request.xhr.status = 0 when we use file:// (without browser) --
    request.xhr.status=200 when we use browser

    but both request.xhr.response contains the json file content in both case (with browser or without)

    THanks and Regards
    Sarang

  7. #7
    Sencha User
    Join Date
    Aug 2011
    Posts
    60
    Vote Rating
    0
    stirucherai is on a distinguished road

      0  

    Default


    Changed the code from

    Code:
     var success = (status >= 200 && status < 300) || status == 304 ,
    to

    Code:
    
    var success = (status >= 200 && status < 300) || status == 304 || status ==0,
    
    Not sure whether this is right approach.

  8. #8
    Sencha Premium Member
    Join Date
    Apr 2008
    Posts
    246
    Vote Rating
    23
    themightychris will become famous soon enough themightychris will become famous soon enough

      0  

    Default


    I use this patch for AjaxProxy in Sencha 1.x:

    Code:
    Ext.util.Observable.observe(Ext.data.AjaxProxy);
    Ext.data.AjaxProxy.on('exception', function(store, response, operation) {
        if(response.status == 0)
            operation.request.callback.call(operation.request.scope, null, true, response);
    });
    It listens for requests that fail because status==0 and calls the original callback with success=true
    Chief Architect @ Jarv.us Innovations
    Co-captain @ Code for Philly
    Co-founder @ Devnuts - Philadelphia Hackerspace

  9. #9
    Sencha User
    Join Date
    Mar 2013
    Posts
    11
    Vote Rating
    1
    tomyuen007 is on a distinguished road

      0  

    Default


    I am trying to read a json file from Sencha Architect Sencha Touch 2 application but getting "MyJsonReader unable to read data. Open in Browser: data/cars.json". I am just trying to read the cars.json file which comes with the example. I posted the question a few times in the Sencha Forum but that did not point me to anywhere that can help me. The odd thing is that I was able to read the cars.json file from the ExtJS app in Sencha Architect.


    I think Sencha Architect is the a good product but if I cannot even read a simple json file, I am not convinced it will help me do our system.


    Can someone help me so that I can move to the next step in my evaluation process.


    Best regards

  10. #10
    Sencha User
    Join Date
    Oct 2013
    Location
    Pune, Maharashtra, India
    Posts
    3
    Vote Rating
    0
    indranilthatte is on a distinguished road

      0  

    Default


    read the topic http://www.sencha.com/forum/showthre...=1#post1004473

    hope this will help you.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi