[SailfishDevel] Access elements in a SilicaListView header
Andrey Kozhevnikov
coderusinbox at gmail.com
Mon Feb 16 20:01:13 UTC 2015
Hello, in this case you can do following:
Page {
SilicaListView {
id: listView
anchors.fill: parent
PullDownMenu {
MenuItem {
text: qsTr("Update search field")
onClicked: { listView.headerItem.text = "hi" }
}
}
header : SearchField {
id: searchField
width: parent.width
placeholderText: "Filter"
}
}
}
17.02.2015 00:57, Sylvain B. пишет:
> Hi,
> I'd like to put a SearchField into the header of a SilicaListView, but I figured out that I can't access it from outside (I want to clear the text when the user refreshes the model).
> The code below will trigger a "ReferenceError: searchField is not defined":
>
> Page {
> SilicaListView {
> anchors.fill: parent
>
> PullDownMenu {
> MenuItem {
> text: qsTr("Update search field")
> onClicked: { searchField.text = "hi" }
> }
> }
>
> header : SearchField {
> id: searchField
> width: parent.width
> placeholderText: "Filter"
> }
> }
> }
>
> Any idea?
> Thanks.
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
More information about the Devel
mailing list