0

I'm working with Framework7 and learning every day. All smooth but now I don't find the solution to this.

I use a template7Data code inside my-app.js with a lot of items that I render in a page later. For example:

var myApp = new Framework7({
    precompileTemplates: true,
    template7Pages: true,
    template7Data: {
        cars: [
            {
                internalID: 01,
                name: Renault,
            },
            {
                internalID: 02,
                name: Ford,
            },
            {
                internalID: 03,
                name: Tesla,
            },
        ],
    }
});

My problem is that when my page loads this "list" of items I want to be orderer alphabetically, instead of the order that I have written in the code above. In this example, the result that I have is:

Renault
Ford
Tesla

How can I do to obtain the order alphabetically of "names" ignoring the "internalID".

Hope I'm clear, my english is kinda poor :P

Thanks in advance!

Mats
  • 23
  • 6

1 Answers1

0

Do a sort function (related answer). There are many others answers on stackoverflow ;)

Djiggy
  • 602
  • 6
  • 20