Results 1 to 5 of 5

Thread: Is it possible to get NOT JSON response using Ext.data.Store?

  1. #1
    Sencha User
    Join Date
    Oct 2011
    Location
    US, D.C. Area
    Posts
    3
    Vote Rating
    0
      0  

    Default Answered: Is it possible to get NOT JSON response using Ext.data.Store?

    I'm curious is it possible to get not JSON response using 'jsonp' proxy?

    Problem: I have to get cross-domain request to the server that returns response as a simple string. Is it possible to use jsonp proxy for this?

    here is the code that looks like working, but only for FF and Crome... I can't get it working for IE.

    Code:
            Ext.define('search', {
                extend: 'Ext.data.Model',
                fields: []
            });
    
             this.store = Ext.create('Ext.data.Store', {
                model: 'search',
                proxy: {
                    type: 'jsonp',
                    root: '',
                    url: 'some_url_that_return_response_as_text'
                }
            });
    does anybody know what I'm doing wrong? Here is the error that I get in IE9:

    Code:
    SCRIPT5007: Unable to get value of the property 'id': object is null or undefined 
    ext-all-debug.js, line 25524 character 17
    I suspect that I have to configure Store and Proxy somehow, but have no idea how... can't find any information in documentation...

  2. you should be able to specify a reader, like in other proxies:
    http://docs.sencha.com/ext-js/4-0/#!...oxy-cfg-reader

    for the xml-reader, you find configs here (there are other readers in the docs as well)
    http://docs.sencha.com/ext-js/4-0/#!...ata.reader.Xml

  3. #2
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130
    Vote Rating
    129
      0  

    Default

    http://en.wikipedia.org/wiki/JSONP -> padding

    you can use a different reader for the proxy (xml or whatever), but since you are triggering a JS callback function, it has to be readable for the browser.
    Best regards
    Tobias Uhlig

  4. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    US, D.C. Area
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Hi Tobias,
    thanks for the suggestion, but I still can't understand how I can replace callback function in JSONP proxy with my own one. I only can see 'callbackKey' parameter and nothing for the function name...

    could you provide some quick example?

    Thanks for the help,
    Alex

  5. #4
    Sencha User tobiu's Avatar
    Join Date
    May 2007
    Location
    Munich (Germany)
    Posts
    2,751
    Answers
    130
    Vote Rating
    129
      0  

    Default

    you should be able to specify a reader, like in other proxies:
    http://docs.sencha.com/ext-js/4-0/#!...oxy-cfg-reader

    for the xml-reader, you find configs here (there are other readers in the docs as well)
    http://docs.sencha.com/ext-js/4-0/#!...ata.reader.Xml
    Best regards
    Tobias Uhlig

  6. #5
    Sencha User
    Join Date
    Oct 2011
    Location
    US, D.C. Area
    Posts
    3
    Vote Rating
    0
      0  

    Default

    Ok, looks like it fixed... just changed JSON reader on XML. But still don't understand why it happened that way...

    Anyway, thanks for the suggestions and help,
    Alex

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •