Hi again,

Although the problem remains unresolved for me, I found something.

IListDelegate#bindGroupItem(controller,item,id)  receives an id not 
inside model, but inside internal list of groups.



10.07.2015 16:40, Dmitry Pryadkin пишет:
> Hi Everyone,
>
> I have a virtual List with groups. As could be seen from my code, first
> 11 items should be in "Group0" and the rest in "Group0".
>
> However I see both groups as "Group0". What am I doing wrong?
>
> Notice I'm using custom group items via "createGroupItem" and
> "bindGroupItem".
> 1. If I just remove these two functions from the imlementation, the
> Group names are empty.
> 2. If I then remove "groupLabelPath" property from the list construction
> code, the correct Group Names will appear.
> 3. Finally if I bring back my methods from #1 the List won't survive
> errors during binding.
>
> My code can pasted into playground http://demo.qooxdoo.org/devel/playground
>
> var doc = this.getRoot();
>
> var rawData = [];
> for (var i = 0; i < 20; i++)
> {
>       rawData[i] = {
>           label:"Item No " + i,
>           group: (i>10) ? "Group1" : "Group0"
>       };
> }
> var model = qx.data.marshal.Json.createModel(rawData);
>
> //create the list
> var list = new qx.ui.list.List(model).set({
>       labelPath: "label",
>       groupLabelPath: "group",
>       maxWidth: 200
>
> });
>
> // see qx.ui.list.core.IListDelegate
> var delegate =
> {
>       group : function(data)
>       {
>           return data.getGroup();
>       },
>
>       configureItem : function (item)
>       {
>         // change appearance
>       },
>
>       createGroupItem : function()
>       {
>           // we need this Composite as GroupItem because the bounds of
> GroupItem always managed by List and thus
>           // we cannot manipulate its margins, etc
>           var item = new qx.ui.container.Composite(new qx.ui.layout.VBox());
>           var label = new qx.ui.basic.Label();
>           // the label is added to the composite and we can manipulate
> its margins
>           item.add(label);
>           item.$$label = label;
>           // margins defined in the Appearance
>           return item;
>       },
>
>       bindGroupItem : function (controller, item, id)
>       {
>           var label = item.$$label;
>
>           if (id === 0)
>               label.addState("noSeparator");
>           else
>               label.removeState("noSeparator");
>
>           controller.bindProperty(
>               controller.getGroupLabelPath(), "value",
> controller.getGroupLabelOptions(), label, id
>           );
>       }
> };
>
> list.setDelegate(delegate);
> list.setSelectionMode("additive");
>
> //Pre-Select "Item No 20"
> list.getSelection().push(model.getItem(19));
> list.getSelection().push(model.getItem(18));
>
> //log selection changes
> list.getSelection().addListener("change", function(e) {
>     this.debug("Selection: " + list.getSelection().getItem(0));
>     console.log( list.getSelection().getItem(0) );
> }, this);
>
> doc.add(list);
>
> ------------------------------------------------------------------------------
> Don't Limit Your Business. Reach for the Cloud.
> GigeNET's Cloud Solutions provide you with the tools and support that
> you need to offload your IT needs and focus on growing your business.
> Configured For All Businesses. Start Your Cloud Today.
> https://www.gigenetcloud.com/
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>
>


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to