<div dir="ltr">I had similar situation in the past.<div><br></div><div>Data was coming from web, but I needed to rearrange it for QML lists to work.</div><div>What I found useful and working was to just generate a new model in JavaScript (based on empty ListModel if I recall correctly). I had only a couple of dozens of data and it was changing once or twice during app use sessions. So creating a fresh model from scratch was not a problem at all.</div>

<div><br></div><div>Cheers,</div><div>Artem.</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sun, Nov 17, 2013 at 11:59 PM, Tigre-Bleu <span dir="ltr"><<a href="mailto:devel@tigre-bleu.net" target="_blank">devel@tigre-bleu.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, thanks<br>
<br>
I will create my own model with sorting capabilities<br>
<br>
Antoine<br>
<br>
----- Mail original -----<br>
De: "Andrey Kozhevnikov" <<a href="mailto:coderusinbox@gmail.com">coderusinbox@gmail.com</a>><br>
À: <a href="mailto:devel@lists.sailfishos.org">devel@lists.sailfishos.org</a><br>
Envoyé: Dimanche 17 Novembre 2013 14:05:39<br>
Objet: Re: [SailfishDevel] ListModel sorting in QML<br>
<div class="HOEnZb"><div class="h5"><br>
afaik the use of JSONListModel not intended the sorting functions.<br>
you need to make own model and sort json data before pushing it to model.<br>
<br>
On 17.11.2013 18:39, Tigre-Bleu wrote:<br>
> Hi,<br>
><br>
> I have a ListView which loads a model from JSON with JSONListModel. The model contains items and category ids, but is not sorted by category.<br>
><br>
> What I wand to do is to display the items sorted by categories in the ListView. I have put a section.property in the ListView but it is working only half as expected because it is not sorting the model.<br>
><br>
> For instance, if my model content is:<br>
><br>
> Item1 - Category1<br>
> Item2 - Category1<br>
> Item3 - Category2<br>
> Item4 - Category3<br>
> Item5 - Category3<br>
> Item6 - Category1<br>
><br>
> Then my ListView will display:<br>
><br>
> Category1<br>
>    Item1<br>
>    Item2<br>
> Category2<br>
>    Item3<br>
> Category3<br>
>    Item4<br>
>    Item5<br>
> Category1<br>
>    Item6<br>
><br>
> Of course I would like Item6 to be set between Item2 and Item3.<br>
><br>
> How is possible to do that in QML? I would like to avoid manually iterating on all the items to re-order.<br>
><br>
> Thanks,<br>
><br>
> Antoine<br>
> _______________________________________________<br>
> SailfishOS.org Devel mailing list<br>
<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list<br>
_______________________________________________<br>
SailfishOS.org Devel mailing list</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Artem Marchenko<br><a href="http://agilesoftwaredevelopment.com" target="_blank">http://agilesoftwaredevelopment.com</a><br>

<a href="http://twitter.com/AgileArtem" target="_blank">http://twitter.com/AgileArtem</a>
</div>