Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
向Ember.js CollectionView添加选择行为的推荐方法是什么?_Ember.js - Fatal编程技术网

向Ember.js CollectionView添加选择行为的推荐方法是什么?

向Ember.js CollectionView添加选择行为的推荐方法是什么?,ember.js,Ember.js,我基本上需要一个选择视图,但我想一些更具视觉吸引力的东西。我的直觉是我可以使用CollectionView来实现这一点,但我必须自己实现集合中元素的选择。这是惯例吗?有推荐的方法吗?有什么好的例子吗?假设我读对了,你只想要比基本选择列表更漂亮的东西。我不知道你的限制,但我真的很喜欢这些类型的东西 简单:试着根据你的喜好设计你的 {{view Ember.Select contentBinding="App.content" optionLabelBinding="conten

我基本上需要一个选择视图,但我想一些更具视觉吸引力的东西。我的直觉是我可以使用CollectionView来实现这一点,但我必须自己实现集合中元素的选择。这是惯例吗?有推荐的方法吗?有什么好的例子吗?

假设我读对了,你只想要比基本选择列表更漂亮的东西。我不知道你的限制,但我真的很喜欢这些类型的东西

简单:试着根据你的喜好设计你的

{{view Ember.Select 
    contentBinding="App.content" 
    optionLabelBinding="content.text"
    optionValueBinding="content.value"
    selectionBinding="App.selection"
    prompt="Choose ...."}}
如果您使用引导,类似这样的功能应该会起作用

<div class="dropdown">
  <a class="dropdown-toggle" data-toggle="dropdown" href="#">Dropdown trigger</a>
  <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel">
  {{#each App.content}}
      {{#view App.SelectView contentBinding="this"}}{{label}}{{/view}}
  {{/each}}
  </ul>
</div>

此链接是在Freenode上的#emberjs上向我推荐的:


它扩展了CollectionView以允许选择项目。

实际上,我正在尝试构建一些miller列,因此选择不太正确。
App.SelectView = Em.View.extend({
   tagName: 'li',
   click:function(){
      App.set('selected', this.get('content'));
      // then hide the dropdown
   }
});