PDA

View Full Version : Loading "sample" data in to stores for prototyping



kveeiv
1 Feb 2012, 7:24 AM
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.

bharatn
1 Feb 2012, 8:11 AM
Hi Kveeiv,
Did you try the menu option 'Load Data" from the Store instance?

kveeiv
1 Feb 2012, 10:09 AM
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.

PranKe01
2 Feb 2012, 7:55 AM
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:


{
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?

bharatn
2 Feb 2012, 8:00 AM
right click store and load data.

PranKe01
2 Feb 2012, 10:15 AM
That does work! The store is loaded with the items. But I don't see the list in the designer or in the website...

CaliLuke
2 Feb 2012, 2:31 PM
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.

PranKe01
2 Feb 2012, 11:39 PM
I already defined the template.

31314

And here is the JSON code from the store items:

{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?

PranKe01
3 Feb 2012, 12:32 AM
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 :-/

aconran
3 Feb 2012, 6:21 AM
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 (http://www.sencha.com/forum/forumdisplay.php?97-Sencha-Designer-2.x-Bugs).

CaliLuke
3 Feb 2012, 10:50 AM
I already defined the template.

31314



It looks like you have a layout that's "squashing" your list, so it's there but not showing up. You should try using fit layout in the panel that contains that list (by the way, you don't need an extra panel for it if you're only putting a list, it can stay on its own as a child of MenuView.

The other alternative is to set an height on the list, that should get you started. If you have more than one component you can use an HBOX layout and set flex properties.

I hope this helps a bit, let me know if that gets you anywhere.

PranKe01
4 Feb 2012, 2:23 AM
Hi,

thanks for your help! I could resolve the problem - but I think it was a "layout-bug". It works now, but I can't tell you what the problem was.

Anyway - thanks :)

baushaug
1 Mar 2012, 9:45 AM
I seem to be having the same problem and I've tried using a list and dataview.

My layout is not squashing my data bound control because I can scroll it and see it but it's just blank.


So how can I fix this ?