Gelmiş geçmiş en büyük porno sitemiz olan 2pe de her zaman en kaliteli pornoları sunmayı hedefledik. Diğer video sitemiz olan vuam da ise hd porno ağırlıklı çalışmalara başladık.

  1. #1
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    16
    Vote Rating
    0
    jcamozzi is on a distinguished road

      0  

    Default Data Mapping nested fields for a Json Store

    Data Mapping nested fields for a Json Store


    Hi All,


    I'm currently having an issue with mapping nested values in a store within designer. I have a data set that looks like:


    Code:
    {
        "total": 234,
        "issues": [
            {
                "id": "17136",
                "key": "KEY-54321",
                "fields": {
                    "summary": "Sample issue summary"
                 }
             }
          ]
    }

    I created a json store to pull this data, and a model with two fields: "key" and "summary". I also set up a basic grid and tied it to the store.


    The store has a root of "issues", and if I just use the "key" column in the grid, it loads fine. But I want to map the summary field as well. So, for that field I use a name of "summary" and add a mapping of "fields.summary".


    In Sencha designer I can then tell the json store to load, and the grid loads up the results just fine in the grid. But when I try to preview the app, nothing loads. At first I was getting an "invalid object error on 'summary'", now nothing loads at all.

    It seems odd that it would work in the designer, but not on the preview. The site is set up on a web server and everything loads in my viewport except the json store. Am I missing something, or is this a potential bug?

    As a side note I've noticed if I change around the field info, the grid never properly updates to show this - even when I reload the json data. I have to quit the designer, reopen it, and reload the json in order to see my modified results. Has anyone had this occur?

    Thanks for you help!

    Jeff Camozzi

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,064
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by jcamozzi View Post
    So, for that field I use a name of "summary" and add a mapping of "fields.summary".
    This is the correct way of doing this.


    Quote Originally Posted by jcamozzi View Post
    In Sencha designer I can then tell the json store to load, and the grid loads up the results just fine in the grid. But when I try to preview the app, nothing loads.
    ANy errors? Is your storeId and userClassName setup properly? They should both be the same thing and linked via that identifier.

    Quote Originally Posted by jcamozzi View Post
    As a side note I've noticed if I change around the field info, the grid never properly updates to show this - even when I reload the json data. I have to quit the designer, reopen it, and reload the json in order to see my modified results. Has anyone had this occur?
    Are you saying you make changes to the data on the server-side reload and the results don't change? If so thats a bug that we need to fix.

    If you are implying by reordering the order of fields in a Store that they should update in the grid, that is not the case. The column order of the grid defines that.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    16
    Vote Rating
    0
    jcamozzi is on a distinguished road

      0  

    Default


    Quote Originally Posted by aconran View Post
    ANy errors? Is your storeId and userClassName setup properly? They should both be the same thing and linked via that identifier.
    So, the model has a different classname than the store, but the store is linked to the model:

    Code:
            me.callParent([Ext.apply({
                storeId: 'MyJsonStore',
                model: 'MyApp.model.JiraFilterResult',
                proxy: {
                    type: 'ajax',
                    url: <json URL>,
                    reader: {
                        type: 'json',
                        root: 'issues'
                    }
                }
            }, cfg)]);
    Are you saying the model name must match the store name exactly? I don't get errors in sencha designer, but I did get an error from preview that said something like "invalid object". It seemed to be referring to the "fields" portion of fields.summary. Note that for some reason now I can't reproduce that error - instead the store isn't loading at all from the preview (though it still loads fine in the designer).

    Quote Originally Posted by aconran View Post
    Are you saying you make changes to the data on the server-side reload and the results don't change? If so thats a bug that we need to fix.

    If you are implying by reordering the order of fields in a Store that they should update in the grid, that is not the case. The column order of the grid defines that.
    What I mean is, I have the grid with a "key" and "summary" column. I load my json in the designer and the data populates with keys / summaries. Then as a test I went to my model's "summary" field and changed the mapping to point to "id". I would expect the grid would refresh and all previous results showing summary values would now show the value of "id" but it doesn't. I try triggering a refresh of the json data but the grid doesn't change and still shows the summary data instead of IDs. I have to quit the designer and reopen to see the grid update with the correct values.

    I would like to note I'm on Mac OS 10.7 (lion). I'm using an AMPPS stack (like XAMPP or any other standard stack).

    By the way, thanks for the quick response!

  4. #4
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,064
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Quote Originally Posted by jcamozzi View Post
    Are you saying the model name must match the store name exactly?
    No, but the userClassName of the store and storeId must match. This is a limitation of Ext JS's MVC package.

    The other issue of when you change the field's mapping the store not updating, this is a bug that we need to fix.
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  5. #5
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    16
    Vote Rating
    0
    jcamozzi is on a distinguished road

      0  

    Default


    Okay, so yes, the userClassName and the storeid do match - and that seems to make sense since the grid in the designer does load.

    Any more thoughts on why the preview may not be working?

    Thanks!

  6. #6
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    16
    Vote Rating
    0
    jcamozzi is on a distinguished road

      0  

    Default


    So somehow it started working. I went back and saw that "autoload" was turned off on the store. So I turned it on. Then for the heck of it, hit preview again and this time all the data loaded. The grid reloading problem still exists in the designer, but it seems my preview is finally loading the store. I can't imagine that autoload was the thing that fixed it, but I'll keep an eye on it as I continue testing and make a note if I see the problem reoccur.

  7. #7
    Sencha Premium Member
    Join Date
    May 2010
    Posts
    16
    Vote Rating
    0
    jcamozzi is on a distinguished road

      0  

    Default


    One more comment on grid loading I just discovered. Changing the model data behind the columns doesn't update the grid, but if I resize the column it will update. So I do have a workaround there that doesn't require quitting / reopening. Maybe a simple "refresh" option would be good?

Thread Participants: 1