Quantcast

right way to re-populate an EdgeToEdgeStoreList

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

right way to re-populate an EdgeToEdgeStoreList

Marco Trapanese
Hello,
I'm quite new to dojo and I'm working on a dojox/mobile application.
I set an EdgeToEdgeStoreList with custom ListItems:

javascript

> var list = registry.byId("myList");
> var store = new Memory({data: JSON.parse(myData), idProperty: "label"});
> list.setStore(store);
> showAllItem = new ListItem({
>                 id: "showAll",
>                 label: "Show all",
>                 onClick: showAll,
>                 moveTo: "#",
>                 noArrow: true
>             });
> list.addChild(showAllItem);

html
> div(data-dojo-type="dojox/mobile/ScrollablePane")
>     ul#myList(data-dojo-type="dojox/mobile/EdgeToEdgeStoreList"
> data-dojo-props="itemRenderer: myItem, select: 'single'")

list item

>
> define([
>     "dojox/mobile/ListItem",
>     "dijit/_TemplatedMixin",
>     "dijit/_WidgetsInTemplateMixin",
>     "dojox/mobile/Badge",
>     "dojo/_base/declare"
> ], function (ListItem, TemplatedMixin, _WidgetsInTemplateMixin, Badge,
> declare) {
>     var template =
>         "<div class='areaDone${done}'>" +
>         "       <div class='listDiv' style='display: inline;'
> data-dojo-attach-point='labelNode'></div>" +
>         "       <div class='badgeDevices mblDomButtonBlueBadge'
> data-dojo-type='dojox/mobile/Badge'
> data-dojo-props='value:${devicesSize}'></div>" +
>         "       <div class='badgeNotes'
> data-dojo-type='dojox/mobile/Badge'
> data-dojo-props='value:${notesSize}'></div>" +
>         "</div>";
>
>     TemplatedListItem = declare("myItem",
>         [ListItem, TemplatedMixin, _WidgetsInTemplateMixin], {
>             label: "",
>             notesSize: 0,
>             devicesSize: 0,
>             done: "false",
>             templateString: template
>         }
>     );
> });

I periodically receive a new "myData" string with the new items to show
and of course I cannot just re-run the js snippet above because it will
re-instantiate the same widgets.
I also tried to use list.destroyRecursive() and add a new one via js,
but I was in trouble with the ScrollablePane behavior.

Hence I'm wondering what is the right way to re-populate an
EdgeToEdgeStoreList with custom items.
Thanks!



--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
Loading...