1. #1
    Sencha User
    Join Date
    Feb 2011
    Location
    Düsseldorf, Germany
    Posts
    557
    Vote Rating
    31
    Kurt001 has a spectacular aura about Kurt001 has a spectacular aura about

      0  

    Question [Noob Question] Send complex Object to JSON Store

    [Noob Question] Send complex Object to JSON Store


    Hi there,

    I receive a Json object from the server and now I need to create a store for this.
    But the object is quite complex and I need a starting point how to think, to solve this.
    How would the model and store would look like so that I can add Ajax.Object in there?
    Can you give me an example to the following structure:

    Code:
    Object
        IsSearch: true
        MyGames: Array (25)
            0: Object
                storedInFolder: 3
                Game: Object
                    jumps: false
                    runsOn: Object
                        Win: "007"
                        Max: false
                    details: Object
                        howGood: "10/10"
                        publishingDate: "12.12.1982"
                    stillAvailable:false
            1: Object
                storedInFolder: 3
         ... (and so on)
    I have mainly problems with the objects inside the object and how to show this inside the model for the store. Here is a try, which did not work:

    Code:
    Ext.regModel('ajaxObject.model', {
        fields: [
            'storedInFolder',
                'Game',
                    'jumps',
                    'runsOn',
                        'Win',
                        'Max',
                    'details',
                        'howGood',
                        'publishingDate',
                    'stillAvailable'
        ]
    });
    Please let me know how to set up the model.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2008
    Posts
    710
    Vote Rating
    5
    Bucs is on a distinguished road

      0  

    Default


    Not sure a model is the way to go when your JSON object is that nested. You might be better manually pulling down the object and loading into the store, something like this:

    Code:
            Ext.Ajax.request({
                url: 'url/getData',
                params: {
                    param1: 'someValue' 
                },
                success: function (response, opts) {
                    // Decode the response into a JSON object
                    jsonResponse = Ext.decode(response.responseText);
    
                    var store = Ext.getCmp('yourStoreId');
                    // OR if store is configured with 'storeId' property, you can use 
                    // store = Ext.StoreMgr.lookup('storeId');
    
                    // Ensure you have results
                    if (jsonResponse.results) {
                        if (jsonResponse.results.length > 0) {
                            store.loadData(jsonResponse.results, false);
                    .....
    Give that a shot, hopefully it gets you pointed in the right direction.

  3. #3
    Sencha User
    Join Date
    Jul 2011
    Posts
    2
    Vote Rating
    0
    Sree vidhya is on a distinguished road

      0  

    Default


    Hi,
    I have an issue with Json query.
    I am using Javascript, json and dojo for display. I have a grid where i display a set of records. I have filter option where i can customize by giving my own filter. If i give constructing json query like != as <> and *a* , it is working fine.
    My requirement is filter should also work for !=*a* which means it should return string which doesnt have letter 'a'.

    Please help me in achieving the same..Thanks.

  4. #4
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Hi Kurt001.
    You can do it without problem with model definition and associations.
    Post me the json you want lo load (just give me one or two elements for big array) and I will write you an example on how to do it.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


Similar Threads

  1. TabBars and iconCLS (just another newbie noob noob question)
    By StayArrr in forum Sencha Touch 1.x: Discussion
    Replies: 0
    Last Post: 13 Feb 2011, 1:21 AM
  2. Send JSON object to PHP
    By slckysr in forum Ext 3.x: Help & Discussion
    Replies: 3
    Last Post: 15 Jan 2011, 5:42 PM
  3. Complex json object into a GridPanel
    By MmarcoM in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 24 Aug 2009, 7:33 AM
  4. How send complex data in JSON
    By vsanchez in forum Ext 2.x: Help & Discussion
    Replies: 2
    Last Post: 3 Jul 2008, 5:04 AM

Thread Participants: 3

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar