Sproutcore:LabelView中不显示文本

时间:2012-12-04 19:31:37

标签: javascript label sproutcore

以下是LabelView的定义。设置的是什么,因为其值在单击时也会显示在警告框中。但是只有警告框显示输出。:

    outputView: SC.LabelView.design({
          layout: { width: 500, height: 18 }, 
          valueBinding: SC.Binding.oneWay('Tree.categoriesControllerList.selection.content'),
          click: function(){ 
             alert(Tree.categoriesControllerList.getPath('selection.firstObject.content'))
          }})

由于某种原因,未设置标签的value。给出的值为viewUpdate,定义如下:

viewUpdate: function(){         
          if (this.didChangeFor('selectionDidChange', selection')&&this.getPath('selection.firstObject.notes')==null){
                    return this.getPath('selection.firstObject.content')
            }
        }.property()

我确定这会返回正确的值,因为无论何时单击标签,其值都会按照说明显示在警告框中。

我哪里错了?

1 个答案:

答案 0 :(得分:1)

我认为你只是忘记了值绑定中的“firstObject”:

valueBinding: SC.Binding.oneWay('Tree.categoriesControllerList.selection.firstObject.content'),
相关问题