Dynamically create lists

My application currently has a list of items that are populated from a database. The list can be repopulated at any time during the application's use. I don't use an enyo.List kind - I use the enyo.Repeater kind:

{kind: "Repeater", fit: true, name: "listFavorite", ontap: "itemFavoriteTapRepeater", touch: true, onSetupItem: "setupFavorites", components: [
      {name: "itemLine", ontap: "itemFavoriteTapItem", onhold: "itemFavoriteHold", onrelease: "itemFavoriteRelease", components: [
            [... stuff ...]
      ]}
]}
In the setupFavorites() function, I can query a database and dynamically populate the listFavorite repeater.

I see that Enyo 2.2 now supports swipeable actions as well as reordering for enyo.List kinds. I haven't found out how to dynamically populate an enyo.List, however, from data contained in the database. Is there any good tutorial or sample you might point me to on how to use a List in connection with a database?

Thanks!

Comments

  • The setupItem event handler for enyo.List is almost the same as for enyo.Repeater. Usually you set the list's length based on the size of the database, and as you get more data, you adjust the length. If all the records are invalidated, you call reset on the list to have it re-render from your data.
Sign In or Register to comment.