I have a tableview and I want to open a dialog box on onPressAndHold on a row and display the value of the cell of the row "orderNumber". But i get the Error message: ReferenceError: row is not defined
TableView {
id: tableviewopenorders
height: 180
clip: false
visible: true
onPressAndHold: oocanceldialog.open()
TableViewColumn {
id: orderNumberColumn
role: "orderNumber"
title: "Order Number"
}
model: openordersModel
}
ListModel {
id: openordersModel
ListElement {
orderNumber: "1223455"
}
ListElement {
orderNumber: "111111"
}
}
Dialog {
id: oocanceldialog
title: "Cancel confirmation"
standardButtons: Dialog.Ok | Dialog.Cancel
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Label {
text: openordersModel.get(row).orderNumber
}
onAccepted: console.log("Ok clicked")
onRejected: oocanceldialog.close()
}
row
in the expressionopenordersModel.get(row).orderNumber
. Is that the line causing the error? Is there an event handler for clicking on individual rows vs clicking on the table itself? Maybe try looking for something like that? – killthrushonPressAndHold: oocanceldialog.open()
withonPressAndHold:console.log(openordersModel.get(row).orderNumber)
the I got the correct output printed when i press and hold on the first row i got the 1223455 and when i press and hold on the second row then i got 111111 printed.. But this line is not working when its outside the tableview context – Sebastian Waleckoproperty int row
to the dialog and so set it from pressandhold handler before opening that. – folibis