Custom ListView Row, can no longer select rows...

Posted by LDK on Stack Overflow See other posts from Stack Overflow or by LDK
Published on 2011-01-08T03:23:28Z Indexed on 2011/01/08 3:53 UTC
Read the original article Hit count: 191

Filed under:

Here's my ScrollView:

 middle: SC.ScrollView.design({
  layout: { top: 36, bottom: 32, left: 0, right: 0 },
  backgroundColor: '#ccc',

  contentView: SC.ListView.design({
    contentBinding: 'Spanish.wordsController.arrangedObjects',
    selectionBinding: 'Spanish.wordsController.selection',
    contentValueKey: "word",
    contentDisplayProperties: 'word english'.w(),
    selectOnMouseDown: YES,

    exampleView: Spanish.CustomListItemView

  })
})

and here is my custom listView row:

Spanish.CustomListItemView = SC.View.extend({
  render: function(context, firstTime){
    var content = this.get('content');

    var word = content.get('word');
    var english = content.get('english');

    context = context.begin().push(' %@ (%@)'.fmt(word,english)).end();
    return sc_super();
  }
});

The above works as expected, except that I can no longer select views. When I comment out "exampleView: Spanish.CustomListItemView" I can select rows, but they are no longer formatted properly. Why can I no longer select rows when I use exampleView?

© Stack Overflow or respective owner

Related posts about sproutcore