Hi
On Wed, Nov 17, 2010 at 5:35 PM, Johny Cage <[email protected]> wrote:
> Hi all,
>
> being new to qooxdoo, I'm having some trouble figuring out several
> concepts.
>
Welcome,
>
> Here's a small snippet of code, taken from the Finder demo :
>
> var store = new qx.data.store.Json("finder.json");
>
> var retrievedList = new qx.ui.form.List();
>
> var listController = new qx.data.controller.List(null,
> this.retrievedList);
> listController.setLabelPath("name");
>
> store.bind("model.files", listController, "model");
>
>
> Now, as far as I can understand, bind get's the "store"'s model to be
> synchronized with the listcontroller's model.
>
Right.
> What is the role of LabelPath for the listController though? Why do we need
> to use it?
>
>
LabelPath is what attribute of the record you want to show in the ListItem.
In that wxample there is just "name" but it could be: { id: 1, name: "item
1"} you could use setLabelPath("id") or setLabelPath("name"). It depends on
what you want to show.
> also, what does "model.files" resolve to in the store's model? What should
> we have done if we had wanted to retrieve the other nodes instead?
>
You can get a lot of stuff in one store. So you need to tell what is the
object you want to use in that particular controller. It is useful when you
have one store and more than one controller attached to it.
does bind call something like 'model["files"]' ? What if it was the 'name'
> that we had been after?
>
>
If the data your controller expected is in "name" use:
store.bind("model.name", listController, "model");
It needs the "model" before because of the binding. Being model the whole
data the store has, and model.name the "name" object inside the model.
Many thanks for your help.
>
> For convenience, this is what finder.json looks like:
>
> {
> "name": "root",
> "files": [
> {
> "name": "User",
> "files": [
> {
> "name": "All",
> "files": [
> {
> "name": "Adobe"
> },
> {
> "name": "Parallels"
> }
> ]
> },
> {
> "name": "mw",
> "files": [
> {
> "name": "Documents"
> },
> {
> "name": "Downloads"
> },
> {
> "name": "Movies"
> },
> {
> "name": "Library"
>
> ....etc
>
>
>
> ------------------------------------------------------------------------------
> Beautiful is writing same markup. Internet Explorer 9 supports
> standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
> Spend less time writing and rewriting code and more time creating great
> experiences on the web. Be a part of the beta today
> http://p.sf.net/sfu/msIE9-sfdev2dev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>
------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel