1
特定のプロパティに基づいてサブリストを返すリストがあります。このプロパティを外部のコントロールとバインドすることは可能ですか?設定されていると、フィルタされたリストビューは自動的に更新されます。今、私がしなければfilterPropertyを特定の値にバインドしてフィルタリングされたリストビューを更新する方法
:フィルタリングされたリストは、あなたがフィルタリングプロパティリストにiconareacolorを追加する必要が
{{#each MyApp.widgetIconsController.filtered}}
{{#view MyApp.IconView txtBinding ="this"}}
<div> {{unbound txt.widgetName}} </div>
{{/view}}
{{/each}}
MyApp.widgetIconsController = Ember.ArrayProxy.create
iconareacolor: null
content: [
MyApp.ButtonWidget.create({'theme': 'lightblue'}),
MyApp.TextWidget.create({'theme': 'lightblue'}),
MyApp.ButtonWidget.create({'theme': 'lightcoral'}),
MyApp.TextWidget.create({'theme': 'lightcoral'}),
MyApp.InputWidget.create({'theme': 'lightcoral'}) ]
filtered: (->
filteredList = this.get("content").filterProperty 'theme', this.get('iconareacolor')
).property("[email protected]").cacheable()
問題を解決していなかったプロパティリストにiconareacolorを追加し、私は[デモを投稿http://jsfiddle.net/lily/AR7Kr/](http://jsfiddle.net/lily/AR7Kr /)、「青」または「赤」のテキストをクリックすると、フィルタリングされたリストが表示されると思われます。 – lilyfrommars
「色」の綴りを綴り、「色」を綴っています。国際英語と英国英語が問題を引き起こしています。私の答えとjsfiddleを更新しました:http://jsfiddle.net/tomwhatmore/AR7Kr/1/ –
最後に、Ember.ArrayProxy.createを使用する代わりに、Ember.ArrayController.createを使用する必要があります。ここでは作業デモです[リンク](http://jsfiddle.net/lily/jcpAs/) – lilyfrommars