I have created one nested ListModel.
ListModel {
id: mainModel
ListElement {
mainName: "Alphabet"
subAlpha: [
ListElement { alphaName: "A" },
ListElement { alphaName: "B" }
]
} }
How can I add element in inner list using javascript? In other words, how can I add element to subAlpha model?
Best Answer
Use
subAlpha.append()
. This method takes a Javascript object as an argument, which it uses to create a new ListElement with those keys and values.A working example: