Results 1 to 3 of 3

Thread: Store with API proxy splitting up json string.

  1. #1

    Default Store with API proxy splitting up json string.

    I am having the following issue trying to return a json object via ajax and attach it to a grid. It seems that the store is splitting my result up character by character.

    Here is my example.
    The json object.
    Code:
    {"cardno":"125652","lastused":"20/01/2017","lastamount":"25.06","reversals":"15"}
    And my Store.

    Code:
    Ext.define('CardStore', {        extend : 'Ext.data.Store',
            alias : 'store.card',
            fields: ["cardno", "lastused", "lastamount", "reversals"],
            model: 'CardModel',
            autoLoad: true,
            proxy: {
                type: 'ajax',
                url: 'http://localhost:52096',
                reader: {
                    type: 'json'
                },
                api: {
                    read: 'http://localhost:52096/card/CardDetails'
                }
            }
        });


    If I do a getStore in the inspector, load the store and get the data, I get a constructor for each letter.
    Code:
    store.data.first().data


    gives me
    Code:
    "{"
    for instance. Please help me out.

  2. #2
    Sencha - Support Team bjdurham85's Avatar
    Join Date
    Mar 2014
    Posts
    962
    Answers
    55

    Default

    Hi--,

    I can't tell the headers from your response but I put your example in a Fiddle and it seems to load and log the data. Does this work for you? And/or have you been able to get working in a grid?

    https://fiddle.sencha.com/#view/editor&fiddle/1q2m

    Regards,
    Bryan

  3. #3

    Default Re: Store API proxy.

    Hi Bryan. Thank you for your reply. I got the issue resolved. My api is written in C#. The issue was to do with my header. I returned the json string but needed to create a HttpResponse before returning it. It works well now thank you for your help.

Similar Threads

  1. loading Store from raw JSON string
    By ekrivopaltsev in forum Sencha Touch 2.x: Q&A
    Replies: 1
    Last Post: 13 Jun 2012, 8:35 AM
  2. json string already exists, how to put in a store
    By kgrigor in forum Ext: Discussion
    Replies: 1
    Last Post: 29 Jul 2011, 12:05 PM
  3. can i store json string to Ext.data.store?
    By a2rdvark in forum Sencha Touch 1.x: Discussion
    Replies: 2
    Last Post: 28 Oct 2010, 3:26 PM
  4. bind json string to store
    By wp.joju in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 21 Jan 2010, 4:53 AM
  5. Process json string to Store
    By Chemist in forum Ext 2.x: Help & Discussion
    Replies: 1
    Last Post: 15 Apr 2008, 4:47 AM

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
  •