0
我的要求是使用EmberJS使用動態屬性名稱對數組進行排序。使用Ember JS進行多列分類
什麼我有一列排序以前做的是
ents = @get('acceptedEntities') //get the array
@set('sortAscending', [email protected]('sortAscending'))
sort_data = ents.sortBy(property_name) //property name is sort order
而且我在尋找什麼ID
ents = @get('acceptedEntities')
@set('sortAscending', [email protected]('sortAscending'))
sort_data = ents.sortBy([property_name1, property_name2])
我試圖與上述解決方案,但沒有運氣,我在這裏大約排序計算 並像這樣執行
model = @get('acceptedEntities')
sortProperties = [property_name, 'entity_sf_account_name']
sort_data = Ember.computed.sort(model, sortProperties)
但Sortin克是不正確的,請給我建議做到這一點。
我想這太
sortProperties = ['one:asc', 'two:desc', 'three:asc']
sort_data = Ember.ArrayProxy.createWithMixins(Ember.SortableMixin, {
content: model,
sortProperties: sortProperties
})
上面的代碼工作正常,多參數挑選,但是當我想排序責令其工作不正常
感謝
謝謝你完美的作品:) – santosh
嘿它的工作很好,當我不使用上升和下降,但如果我使用它的一列它沒有正確排序。 sortProperties = [property_name,'entity_sf_account_name:asc','portfolio_name:asc'] – santosh
我會認爲這只是'SortableMixin'工作方式的一個怪癖(bug)。我只是總是確保每個房產都有訂單。 – GJK