Hi Chris, I can reproduce this behavior with the code you posted and it seems to be a bug. I have encountered some days ago also a problem with section handling. If you are appending a new Item to the list, while you use FullString section headers, it's creating a new section, even if it is already there. The expected behavior should be, that the new item is sorted under the right section. Especially in my intended use case, it's a problem because I want to fetch some data from an online source and sort it in different sections. But how to do that, without appending? Insert is also not possible at all, because it's varying always. Even if the model is set after, appending (again) - it's not working. Also a code example added at the bottom (just modified your code). The new person/item with name "Tom" should be displayed in Boss section, but the ListView creates another "Boss" section at the end of the list.
Maybe both are relating to each other? Thank you very much. Gabriel. import QtQuick 2.0 import Sailfish.Silica 1.0 Page { id: page SilicaListView { id: contactList anchors.fill: parent model: contactModel delegate: Label { text: model.name width: page.width } section.property: "section" section.criteria: ViewSection.FullString section.delegate: Rectangle { height: 50 width: page.width color: Theme.secondaryHighlightColor opacity: 0.5 Label { anchors.horizontalCenter: parent.horizontalCenter text: section } } PullDownMenu { MenuItem { text: "Add a person" onClicked: { // comment out to set the model again, but thats not working at all. :-/ // contactList.model = emptyList contactModel.insert({"name": "Tom", "section": "Boss"}) // contactList.model = contactModel } } } } ListModel {id: emptyList} ListModel { id: contactModel ListElement { name: "Achim" section: "Boss" } ListElement { name: "Ana" section: "Friends" } ListElement { name: "Bezelbub" section: "Friends" } ListElement { name: "Billy" section: "Friends" } ListElement { name: "Boris" section: "Friends" } ListElement { name: "Carrie" section: "Friends" } ListElement { name: "Cassie" section: "Friends" } ListElement { name: "Eziekiel" section: "Family" } ListElement { name: "Gargantua" section: "Family" } ListElement { name: "Gilbert" section: "Family" } ListElement { name: "Giles" section: "Family" } ListElement { name: "Gog" section: "Workgroup" } ListElement { name: "Mabel" section: "Workgroup" } ListElement { name: "Magog" section: "Workgroup" } } } Am Mittwoch, den 29.01.2014, 19:56 +0100 schrieb christopher.l...@thurweb.ch: > Hi all > > I have come across some more strange behaviour. > > This time it is a ListView / SilicaListVew with a SectionDelegate > based on FirstCharacter. > > For the items initially displayed this works well, with the section > headers exactly where I would expect them (e.g between Anne and Babs > in the code below) > > But as I flick up, I then a section header between each item (e.g > between Gargantua and Gilbert). > > The code below demonstrates this on the emulator. > > Grüsse > > Chris > > > import QtQuick 2.0 > import Sailfish.Silica 1.0 > > Page { > id: page > > SilicaListView { > id: contactList > anchors.fill: parent > model: contactModel > delegate: Label { > text: model.displayLabel > width: page.width > } > section.property: "displayLabel" > section.criteria: ViewSection.FirstCharacter > section.delegate: Rectangle { > height: 10 > width: page.width > color: "lightblue" > } > } > > ListModel { > id: contactModel > ListElement { > displayLabel: "Achim" > } > ListElement { > displayLabel: "Ana" > } > ListElement { > displayLabel: "Anne" > } > ListElement { > displayLabel: "Babs" > } > ListElement { > displayLabel: "Barnie" > } > ListElement { > displayLabel: "Barry" > } > ListElement { > displayLabel: "Bezelbub" > } > ListElement { > displayLabel: "Billy" > } > ListElement { > displayLabel: "Boris" > } > ListElement { > displayLabel: "Carrie" > } > ListElement { > displayLabel: "Cassie" > } > ListElement { > displayLabel: "Charlie" > } > ListElement { > displayLabel: "Chris" > } > ListElement { > displayLabel: "Diana" > } > ListElement { > displayLabel: "Donald" > } > ListElement { > displayLabel: "Doris" > } > ListElement { > displayLabel: "Egbert" > } > ListElement { > displayLabel: "Ethel" > } > ListElement { > displayLabel: "Eziekiel" > } > ListElement { > displayLabel: "Franzi" > } > ListElement { > displayLabel: "Freddy" > } > ListElement { > displayLabel: "Gargantua" > } > ListElement { > displayLabel: "Gilbert" > } > ListElement { > displayLabel: "Giles" > } > ListElement { > displayLabel: "Gog" > } > ListElement { > displayLabel: "Mabel" > } > ListElement { > displayLabel: "Magog" > } > } > } > > > > > _______________________________________________ > SailfishOS.org Devel mailing list
signature.asc
Description: This is a digitally signed message part
_______________________________________________ SailfishOS.org Devel mailing list