1. #1
    Sencha Premium Member
    Join Date
    Mar 2008
    Posts
    92
    Vote Rating
    1
    kveeiv is on a distinguished road

      0  

    Default Loading "sample" data in to stores for prototyping

    Loading "sample" data in to stores for prototyping


    I think this is my own failing to figure out the proper conventions, so I am opening this up in the help forum instead of the bugs.

    I would like to see List (or I guess probably DataView) type components show their data while in design view.

    To attempt to do this I have:
    * Added a model ("Account")
    * Added a store ("Accounts") with config options of model "Account" and data as an array of json data matching the model definition
    * Added a memory proxy to "Accounts" with default config
    * Added a json reader to memory proxy with idProperty set properly
    * Created a List using the Accounts store

    When running this from within the browser, the store data is properly loaded which the List reflects, and through the console I can verify that the records in Ext.getStore('Accounts') are all populated correctly (the expected values in .data and the various id member variables).

    When viewing this in the designer, the only thing that shows is emptyText, if it is set - and regardless of whether deferEmptyText is set.

    Do I have something wrong in my configuration? Am I trying to do the impossible? Should this be possible and moved over to Bugs? Any guidance is appreciated.

  2. #2
    Sencha User
    Join Date
    Jun 2011
    Posts
    350
    Vote Rating
    1
    bharatn is on a distinguished road

      0  

    Default


    Hi Kveeiv,
    Did you try the menu option 'Load Data" from the Store instance?

  3. #3
    Sencha Premium Member
    Join Date
    Mar 2008
    Posts
    92
    Vote Rating
    1
    kveeiv is on a distinguished road

      0  

    Default


    Quote Originally Posted by bharatn View Post
    Hi Kveeiv,
    Did you try the menu option 'Load Data" from the Store instance?
    Awesome, I figured that would have to be somewhere already since it seems like a basic use case. Thanks! That was easy once I knew what to do.

    I hadn't looked through the context menus on all the different project items, there are a lot of good things in those but from a beginning designer user's perspective they do not jump out as available.

    Maybe some tool icons or something could be presented inline with the collapsible "what class is this" block for alternative access to those context options. For the store load at least specifically, there is an "eye" tool icon that shows up next to the store after loading the data, which shows the response. A state might be added to this tool that initiates the load data process, which I can imagine saving lots of time when needing to often load the store data. Similarly, there is probably some usefulness to being able to clear the store data as well.

    Just some general low priority feedback! Thanks for the quick response, it feels much better to be prototyping while seeing real list data.

  4. #4
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    330
    Vote Rating
    1
    PranKe01 is on a distinguished road

      0  

    Default


    Hi guys,

    I tried to load data from local disk to the list. The store works fine - I see that all 6 items are loaded. But the list in the designer and in the html-page is empty The store is linked to the list... The itemTpl looks like this:

    <div>{item}</div>

    And the JSON looks like this:

    Code:
    {    
    success: true,
        
    total: 6,
        
    items: [
            
    {
                id: 1,
                item: 'item1'
            },
            
    {
                id: 2,
                item: 'item2'
            },
            
    {
                id: 3,
                item: 'item3'
            },
            
    {
                id: 4,
                item: 'item4'
            },
            
    {
                id: 5,
                item: 'item5'
            },
            
    {
                id: 6,
                item: 'item6'
            }
        ]
    }
    Any hints?

  5. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    350
    Vote Rating
    1
    bharatn is on a distinguished road

      0  

    Default


    right click store and load data.

  6. #6
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    330
    Vote Rating
    1
    PranKe01 is on a distinguished road

      0  

    Default


    That does work! The store is loaded with the items. But I don't see the list in the designer or in the website...

  7. #7
    Sencha User
    Join Date
    Jun 2009
    Location
    Redwood City, CA
    Posts
    197
    Vote Rating
    6
    CaliLuke is on a distinguished road

      0  

    Default


    you need a template for that. In your list, click on edit template, then map some fields to your data. Going through the getting started tutorial we have in our documentation will help you understand this step.
    --
    Luca Candela
    twitter: @luckymethod

  8. #8
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    330
    Vote Rating
    1
    PranKe01 is on a distinguished road

      0  

    Default


    I already defined the template.

    Unbenannt.jpg

    And here is the JSON code from the store items:
    Code:
    {success: true,
    total: 6,
    items: [
    {
                id: 1,
                item: 'item1'
            },
    {
                id: 2,
                item: 'item2'
            },
    {
                id: 3,
                item: 'item3'
            },
    {
                id: 4,
                item: 'item4'
            },
    {
                id: 5,
                item: 'item5'
            },
    {
                id: 6,
                item: 'item6'
            }
        ]
    }
    Any further hints?

  9. #9
    Sencha Premium Member
    Join Date
    Oct 2009
    Location
    Germany
    Posts
    330
    Vote Rating
    1
    PranKe01 is on a distinguished road

      0  

    Default


    OK, I got it. I added a DataView above the List, which displayed the items correctly. Then I deleted the List and added a new one, which works. I really don't know, what was going wrong there

  10. #10
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,358
    Vote Rating
    128
    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 PranKe01 View Post
    I really don't know, what was going wrong there
    Not sure If it happens again and you feel that you can reproduce a valid bug please post one in the Sencha Designer Bug Forums.
    Aaron Conran
    @aconran
    Sencha Architect Development Team