We build great stuff for you! Talk to us!

Latest articles from the blog

MVVM with Backbone.js

July 7th 2012

I became intruiged with knockout.js recently as I remember my frustration with creating bidirectional bindings between backbone view elements and the models. It turns out there is a very nice solution via Bart Woods ModelBinder plugin for Backbone.

I patched together some classes to make a more declarative style to ModelBinder and it collection binder helpers. It’s just a small experiement but the results are summarized below…

Ensuring the selected item in a sencha touch list is always visible.

April 30th 2012

Sencha Touch “Ext.List” lists are nice and flexible but they have one fiddly problem. If you manually set the selected item in a list from a callback like so

card.on
  activeitemchange: (card, item, oldIndex)=>
    index = card.items.indexOf(item)

    # Change the list selection to reflect
    # the current card
    list.select(index)

where list is a currently defined Ext.List object then all works fine until you select an item that is not currently in the visible window. Grrrrrr it is not visible and there is no public API to help you keep it so.

For example my setup is a card layout on the right and a list on the left reflecting the current card.

iOS Simulator
Uploaded with Skitch!

To select a card you can either directly select an item from the list or proceed sequentially back and forth using the left and right arrow on top of the card…

Archives ... ( click to see )