mardi 26 mai 2015

EmberJS: Sorting model by property in belongsTo

I have a model with the following list of products...

{
    products: [
        {
            id: 1,
            something: "value",
            properties: {
                name: "Name1"
            }
        },
        {
            id: 2,
            something: "value",
            properties: {
                name: "Name3"
            }
        },
        {
            id: 3,
            something: "value",
            properties: {
                name: "Name2"
            }
        }
    ]
}

If I were to sort on these products by sorting on the "product.properties.name" how would I do that? My first idea was to use the sortableMixin and using the following snippet:

sortProperties: ['properties.name'],
sortAscending: true

But that doesn't really product the result I intended. How should I go about this?




Aucun commentaire:

Enregistrer un commentaire