I had similar situation in the past. Data was coming from web, but I needed to rearrange it for QML lists to work. 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.
Cheers, Artem. On Sun, Nov 17, 2013 at 11:59 PM, Tigre-Bleu <de...@tigre-bleu.net> wrote: > Ok, thanks > > I will create my own model with sorting capabilities > > Antoine > > ----- Mail original ----- > De: "Andrey Kozhevnikov" <coderusin...@gmail.com> > À: devel@lists.sailfishos.org > Envoyé: Dimanche 17 Novembre 2013 14:05:39 > Objet: Re: [SailfishDevel] ListModel sorting in QML > > afaik the use of JSONListModel not intended the sorting functions. > you need to make own model and sort json data before pushing it to model. > > On 17.11.2013 18:39, Tigre-Bleu wrote: > > Hi, > > > > 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. > > > > 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. > > > > For instance, if my model content is: > > > > Item1 - Category1 > > Item2 - Category1 > > Item3 - Category2 > > Item4 - Category3 > > Item5 - Category3 > > Item6 - Category1 > > > > Then my ListView will display: > > > > Category1 > > Item1 > > Item2 > > Category2 > > Item3 > > Category3 > > Item4 > > Item5 > > Category1 > > Item6 > > > > Of course I would like Item6 to be set between Item2 and Item3. > > > > How is possible to do that in QML? I would like to avoid manually > iterating on all the items to re-order. > > > > Thanks, > > > > Antoine > > _______________________________________________ > > SailfishOS.org Devel mailing list > > _______________________________________________ > SailfishOS.org Devel mailing list > _______________________________________________ > SailfishOS.org Devel mailing list > -- Artem Marchenko http://agilesoftwaredevelopment.com http://twitter.com/AgileArtem
_______________________________________________ SailfishOS.org Devel mailing list