gpt4 book ai didi

sproutcore - 自定义ListView行,不能再选择行

转载 作者:行者123 更新时间:2023-12-03 13:38:04 25 4
gpt4 key购买 nike

这是我的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

})
})

这是我的自定义listView行:
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();
}
});

上面的工作符合预期,但是我无法再选择 View 。当我注释掉“exampleView:Spanish.CustomListItemView”时,我可以选择行,但是它们的格式不再正确。为什么在使用exampleView时不能再选择行?

最佳答案

子类SC.ListItemView代替。

删除return sc_super();行。

context = context.begin().push(' %@ (%@)'.fmt(word,english)).end();行更改为:

context.push(' %@ (%@)'.fmt(word,english));

现在应该可以工作了。

关于sproutcore - 自定义ListView行,不能再选择行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4632157/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com