ExpandableDecorator.qml Example File
listdecorators/assets/ExpandableDecorator.qml
import bb.cascades 1.0
import bb.cascades.datamanager 1.2
import bb.cascades.decorators 1.2
ActionItem {
ActionBar.placement: ActionBarPlacement.InOverflow
onTriggered: {
expandableModel.load()
listView.dataModel = expandableDecorator
listView.selectionChanged.connect(expandableDecorator.expandHeader)
}
attachedObjects: [
ExpandableDataModelDecorator {
id: expandableDecorator
model: AsyncHeaderDataModel {
id: expandableModel
query: SqlHeaderDataQuery {
source: _sqlImagesDir + "/../discogs_small.db"
query: "select title as name, primary_image, master_genre.genre from master_genre, master where master_genre.master_id=master.id order by genre"
countQuery: "select count(*) from master_genre, master where master_genre.master_id=master.id"
headerQuery: "select master_genre.genre as header, count(*) from master_genre, master where master_genre.master_id=master.id group by header"
onDataChanged: console.log("data changed: revision=" + revision)
onError: console.log("SQL query error: " + code + ", " + message)
}
}
}
]
}