topic of onTriggered in listview
Hello
I need to
I have a listview on the list of all my image
It's my listitemcomponent:
WebView { id :web preferredWidth: 200 preferredHeight: 150 url : ListItemData.imageThumbnailURL }
onTriggered: { clearSelection() select(indexPath) var item = dataModel.data(indexPath) if (item){ //What should i do here? } }
It's my webview that the bigone
WebView{ id : itemimage //url : image ? image["imageThumbnailURL"] : "" }
It is what should show
the small images located on the right side is my: listitemcomponent
the big picture which is on the left side is WebView
If I hit one of my list on the right, it will automatically go to enlarge
What should I do in 'onTriggered '?
Thank you
You can change the URL used by your WebView something like this:
itemimage.url = item.whateverVariableHoldsTheURL
Tags: BlackBerry Developers
Similar Questions
-
onTriggered retail Info (LISTVIEW)
Hello
Sorry to ask again
I want to show the details of my promo
It's my main QML
NavigationPane { id : nav1 onPopTransitionEnded: page.destroy() Page { Container { Header{ title: "Promo" } ListView { id: listViewDemo dataModel: GroupDataModel { id : prm1 grouping: ItemGrouping.None } listItemComponents: [ ListItemComponent { type: "promo" Container { layout: StackLayout { orientation: LayoutOrientation.LeftToRight } WebView { preferredWidth: 150 preferredHeight: 90 verticalAlignment: VerticalAlignment.Top url : ListItemData["ImageLink"] } StandardListItem { title: ListItemData["promoID"] + "." + ListItemData["Title"] description: ListItemData["Description"] leftMargin: 30 verticalAlignment: VerticalAlignment.Center } } } ] function itemType(data, indexPath) { return "promo"; } onTriggered: { if(indexPath!=0){ var promo = prm1.data(indexPath); var promodetail = promocontent.createObject(); promodetail.promo = promo; nav1.push(promocontent); } } } } } } attachedObjects: [ DataSource { id: serviceDataSource source: "http://www.rws.rajaspot.com/rs_promoclient.php" type: DataSourceType.Json onDataLoaded: { listViewDemo.dataModel.insertList(data.promo_info) } }, ComponentDefinition { id : promocontent source : "PromoContent.qml" } ] onCreationCompleted: { serviceDataSource.load(); }
It's my promodetail
Page { property variant promo; Container { id: container1 verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center topPadding: 50 WebView { id : imageview horizontalAlignment: HorizontalAlignment.Center url: promo["ImageLink"] preferredWidth: 400 preferredHeight: 400 } Label { id:label1 textStyle.base: SystemDefaults.TextStyles.BigText horizontalAlignment: HorizontalAlignment.Center text:promo["Title"] } Label { id:label2 textStyle.base: SystemDefaults.TextStyles.SubtitleText horizontalAlignment: HorizontalAlignment.Center text:promo["Description"] } } }
the following error message are
url: promo["ImageLink"]
text:promo["Title"]
text:promo["Description"]
He can't call my main.qml
any suggestion?
Thank you
In some cases, your promo property can be "undefined" after you press page. Because it is not yet assigned. You can avoid this if you check the property on your page.
For example:Page{ property variant promo: null Container{ layout: DockLayout{} leftPadding: 20 rightPadding: 20 topPadding: 20 Label{ id: label horizontalAligment: HorizontalAligment.Center /* In some cases will be the text empty. Because promo property is not yet assigned*/ text: promo.Description } } }
-------------------------------------------------
See the simple example. You have two options to avoid ownership promo "undefined".
1. replace the text property of the label with this
text: promo? Promo. Description:
2. signal property promo label definition
onPromoChanged: if (promo) label.text = promo. DescriptionMy English is bad, so I hope you understand what I mean. Maybe someone who has good English can specify my 'answer '.
EDIT:
You can also find 'Data passing between the QML pages' for more information
-
ListView Access of ListItemComponent context action onTriggered model
Consider following piece of code:
ListView { id: listView dataModel: model listItemComponents: ListItemComponent { content: StandardListItem { title: ListItemData.name contextActions: ActionSet { actions: ActionItem { title: "Delete" onTriggered: { //ListItem.view.model .... doesn't work } } } } } } }
When the user chooses to delete a line, I would like to access the listview model and remove the line given. But I can't get my hands on the model (as it is now defined as attached property).
Docs say:
ListItem.view - The ListView in which this item is visible. The item is in a context separate from the ListView, so any symbols from the ListView context that are to be accessible from items must be placed as dynamic properties on the ListView
But to be honest I don't understand what I need to do to make it work (ie. have access to the parent listView.
Any help would be greatly appreciated.
Oh, I would do this without falling back into C++ code. I know how to solve this problem with c ++.
Thank you
You must reference it in your ListItemComponent ListItem:
myItem.ListItem.view.dataModel
-
To access the instance of the ListView onTriggered event ListItemComponent
Hello
I'm pulling out my hair with this!
I have a ListItemComponent in my ListView, and I want to access the component instance in the onTriggered of my ListView. I have the row, but I can't work on how to find the actual view.
Simple example:
{To ListView
ID: myListView
dataModel: myDataModel
layout: {FlowListLayout}
listItemComponents:]
{ListItemComponent}
type: 'imageItem.
{GalleryImages}
}]
onTriggered: {}
It's easy
var point = dataModel.data (row);
BUT HOW to ACCESS the GalleryImages instance for the row?
}
...
I'm sure it's really simple, but have been hitting my head against it for 2 days!
C
https://developer.BlackBerry.com/Cascades/reference/bb__cascades__listview.html
your variable 'point' reference the underlying data in the datamodel - it does not refer to the list Visual element (i.e. ListItemComponent).
You need to move your manager in the ListItemComponent - and probably change in notecard or anything that supports your component of GalleryImages.
-
ListView onTriggered event to push a new page
Currently, I started to learn and develop applications for bb10. I saw troubled when wants to push a new page when click the item in the listview.
ListView { dataModel: XmlDataModel { source: "model.xml" } listItemComponents: [ ListItemComponent { type: "listItem" StandardListItem { title: ListItemData.title description: ListItemData.subtitle status: ListItemData.status } } ] onTriggered: { var new_page = nextpage.createObject(); navigationPane.push(new_page); } attachedObjects: [ ComponentDefinition { id: nextpage source: "newqml.qml" } ] }
The code that I use, I expect to get to the newqml.qml, then click on any point on the listview however is not doing. How can I change the code to obtain the result.
and if I want it open different page each item in listview how does?
Thanks in advance.
Hello
I'm new on this, but I have a tip that could help: create a new project, select stunts, then on the models page, select ListView.
This will automatically create a default list that automatically connects your article to an ItemPage.qml of a second!
-
onTrigger go to the last line of the ListView
Hello
The above is possible? I have a list of RSS, I would like to know is there a way I can do onTrigger go to the last column in my listView.
Thank you
How can I get the number of items in dataModel?
It depends on dataModel type you use, see the documentation for the corresponding classes.
For ArrayDataModel and GroupDataModel:
var n = dataModel.size () / / or dataModel.childCount (0) - number of students in first section
Row is a table where the first number is the section and the second is stored in the section.
Something like this should work:
var dataModelSize = listViewId.dataModel.size(); // or listViewId.dataModel.childCount(0)if (dataModelSize > 0) { var lastRowNumber = dataModelSize - 1 listViewId.scrollToItem([0, lastRowNumber], ScrollAnimation.Default); }
Replace the listViewId with the id of your ListView.
If this does not work, please copy - paste your current code and errors that appear in the papers (as appropriate).
-
Action on multiple selection ListView onTriggered
Hi, I have a listview with multiSelectHandler impleted and so can select multiple items.
I'm having a problem on how to perform the action on these several items though.
Documentation, http://developer.blackberry.com/cascades/documentation/ui/lists/list_view_selection.html, does not show how to perform the action when several items to the listview are selected.
Does anyone know how to make measurements on multiple items? i.e. remove it from the list, get the text of each article, changes to the user interface, etc.
Hello
Have you seen Battambang sample? I remember well, it can perform operations on several list items:
https://github.com/BlackBerry/Cascades-samples/tree/master/bucketlist
-
I have a ListView that ItemData containing Web sites. When you select an item, it pushes a page from the data. I can view the data. Then I have an action button that pushes another page with a WebView. The problem I have is that the WebView never is completed and said that the web page is unavilable. I have a label that does not display the correct Web page and I can also get the Web page to display if I put the url directly to the page.
Here is the code:
actions: [ ActionItem { title: qsTr("View") imageSource: "asset:///icons/actions/view.png" onTriggered: { var page = htmlPage.createObject(); page.url = "http://www.google.com"; console.log(page.url); navPane.push(page); } } ]
import bb.cascades 1.2 Page { property string url id: htmlPage Container { preferredWidth: Infinity preferredHeight: Infinity verticalAlignment: VerticalAlignment.Center horizontalAlignment: HorizontalAlignment.Center WebView { id: webView settings.background: Color.Black url: url } Label { text: url textStyle.fontSize: FontSize.XXSmall } } }
I tried a lot of different things without success. Anyone have this type of process work?
All of a sudden, it came to me.
property alias url : webView.url
-
Mark the selected item in a listview
Hello experts,
So, I need to show a selected list item by placing a checkmark next to him (into the cell). What a cell can be selected. So does anyone have a solution that can be shared? Or some advise how this can be done properly. I would be very grateful.
Hello everyone.
I did the following. In onTriggered in a listview control, I've added these 2 lines:
clearSelection(); select(indexPath, true);
That's all.
-
ListView grid change to list dynamically
Dear developers
I have a listview that is represented by a grid. But I want a menuaction to change the schedule to the list and vice versa. But it seems more difficult, so I thought. My griditems are different then my listitems. For those who must change too.
That's what I have so far but I'm stuck to be honest.
import bb.cascades 1.0 Container { property bool isGrid: true ListView { id: listView dataModel: channelListVM.otherDataModel horizontalAlignment: HorizontalAlignment.Fill layoutProperties: StackLayoutProperties { spaceQuota: 1.0 } layout: isGrid ? gridLayout : stackLayout listItemComponents: [ ListItemComponent { type: "gridItem" GridItem { contextActions: ActionSet { title: ListItemData.name actions: [ ActionItem { title: qsTr("Favorite") imageSource: "asset:///img/bb_action_favorites.png" onTriggered: { ListItemData.favorite() } } ] } } }, ListItemComponent { type: "listItem" MyListItem { contextActions: ActionSet { title: ListItemData.name actions: [ ActionItem { title: qsTr("Favorite") imageSource: "asset:///img/bb_action_favorites.png" onTriggered: { ListItemData.favorite() } } ] } } } ] function itemType(data, indexPath) { if(isGrid) { return "gridItem"; } return "listItem"; } attachedObjects: [ StackListLayout { id: stackLayout }, GridListLayout { id: gridLayout columnCount: 3 horizontalCellSpacing: 10.0 verticalCellSpacing: 10.0 cellAspectRatio: 1 } ] } }
And when I change the isGrid true or false, it amends the provision but it seems that the UI is not updated. How can I fix without working with 2 ListViews and hide/show them about the property?
Thanks in advance
Since you're using the itemType function you do not require a change in your database. However, given that you match the layout of your choice of item type, you will need to notify the ListView that its cache is no longer valid. If ListView will not selection of the type of return until you load a new element in its cache.
To do this, you just have your DataModel emit a signal after you change your property to isGrid. This is done via DataModel::itemsChanged. Since you want your entire list to rebuild, you want to give him the DataModelChangeType::Init.
Code wise, you need to add this call:
channelListVM.otherDataModel.itemsChanged(DataModelChangeType.Init)
-
Hello
I'm loading (included in the assets of the project) png images in a ListView. Then I want to trigger the framework of the call to share the selected image. And I want to let him choose what applications list. Is this the right way to go:
ListView { layout: GridListLayout {} dataModel: XmlDataModel { source: "data.xml" } listItemComponents: [ ListItemComponent { type: "image" ImageView { imageSource: ListItemData.imagePath } } ] attachedObjects: [ Invocation { id: invoke query { mimeType: "image/png" } } ] onTriggered: { var selectedItem = dataModel.data(indexPath); invoke.uri = selectedItem.imagePath; invoke.trigger("bb.action.SHARE"); } }
Thanks for your help,
LaurentOK sorry it works. I couldn't scroll because listview is initially another container.
-
Access to a component (ImageView) inside the ListView
I have a ListView in which there is an ImageView. When any item is typed, I manage onTriggered Signal. At this signal, I want access the ImageView the ListItem that is typed. How to do this?
I think that the best workaround is using your own object as a data model to the image property. Then you can change it in onTriggered signal just like that ListItemData.imageSource = newImageSource
for example:
// If you are using JSON add a new property which is a imageSource model.append({"name": "bla bla", "imageSource": "bla bla"})
or write a derivered of QObject class as in this example
https://developer.BlackBerry.com/native/reference/Cascades/bb__cascades__GroupDataModel.html
but hope that you use GroupDataModel
Another solution is to write your own function and use instead onTriggered
for example (I like examples of the )
ListView{ function myOwnFunction(indexPath, imageView){ var item = dataModel.data(indexPath); if (item){ // set new image } } } // And access it from ListItemComponent ListItemComponent { type: "" Container { id: root onTouch{ root.ListItem.view.myOwnFunction(root.ListItem.indexPath, imageView) } }
-
Hello I hope yo can help me.
I m, creating an application in Spanish, so. I want to fill a listview and when I select some item, send row, call a qml and fill the other listview in this other qml. All this is done. except, I can filter the query to the data source.
Hery my code
hand. QML where I have a Navegationpane, then SegmentedControl and Lisview (myLVNuevo). When I select an item, I take the Id (selectedItem.IdLibro), I create and send another to the qml (bibliapage.qml). His works, in fact.
NavigationPane { id: navpaneBible Page { Container { horizontalAlignment: HorizontalAlignment.Fill verticalAlignment: VerticalAlignment.Fill leftPadding: 30 topPadding: 30 rightPadding: 30 bottomPadding: 30 SegmentedControl { id: sgfavorites accessibility.name: sgfavorites Option { id: option1 text: "Antiguo" selected: true } Option { id: option2 text: "Nuevo" } onSelectedOptionChanged: { if (selectedOption == option1) { myLVNuevo.visible = false; } else if (selectedOption == option2) { myLVNuevo.visible = true; } } } // The contact list filter input TextField { id: txtBuscar hintText: qsTr ("Buscar...") // onTextChanging: _addressBook.filter = text } //lv2 ListView { accessibility.name: myLVNuevo id: myLVNuevo dataModel: gdmNuevo listItemComponents: [ ListItemComponent { type: "item" StandardListItem { title: ListItemData.IdLibro + ". " + ListItemData.NombreLibro } } ] onTriggered: { if (indexPath.length > 1) { var selectedItem = gdmNuevo.data(indexPath); var contentpage = pageDefinition.createObject(); contentpage.idlibro = selectedItem.IdLibro; contentpage.texto = selectedItem.NombreLibro; navpaneBible.push(contentpage); } } } } attachedObjects: [ GroupDataModel { id: gdmNuevo }, DataSource { id: dtNuevo // Load the data from an SQL database, based on a specific query source: "asset:///sql/MyBiblia.db" query: "select IdLibro, NombreLibro, Testamento from Libros Where Testamento = 'Nuevo' order by IdLibro DESC" onDataLoaded: { // After the data is loaded, insert it into the data model gdmNuevo.clear(); gdmNuevo.insertList(data); } } // end of DataSource ] onCreationCompleted: { dtNuevo.load(); } } // end of Page
But then when the page is loaded, is not load or filter by property string idlibro. Becuse the query in the data source is idlibro.
import bb.cascades 1.4 import bb.data 1.0 import bb.cascades.datamanager 1.2 Page { property string idlibro; property alias texto: lblNombre.text; titleBar: TitleBar { id: titlebar title: texto } Container { id: bibliapagina; Label { id: lblNombre accessibility.name: lblNombre text: texto //qsTr("Pagina de la biblia") + Retranslate.onLocaleOrLanguageChanged } ListView { accessibility.name: myLVCapitulos id: myLVCapitulos dataModel: dm //gdmCapitulos listItemComponents: [ ListItemComponent { type: "item" StandardListItem { title: ListItemData.Capitulo description: ListItemData.Versiculo status: ListItemData.IdVersiculo } } ] onTriggered: { if (indexPath.length > 1) { } } attachedObjects: [ GroupDataModel { id: gdmCapitulos }, DataSource { id: dtCapitulos // Load the data from an SQL database, based on a specific query source: "asset:///sql/MyBiblia.db" query: "select ('Capítulo ' || IdCapitulo) as Capitulo, IdVersiculo, Versiculo from CapitulosVers Where IdLibro = " + lblNombre.text + " GROUP BY IdCapitulo ORDER BY IdCapitulo DESC" onDataLoaded: { gdmCapitulos.clear(); gdmCapitulos.insertList(data); } } ] onCreationCompleted: { dtCapitulos.load(); } } } }
HOW CAN I ACHIEVE THIS?
ITS important to say, its fine words is a set a query without params. example (select * from CapitulosVers Where idlibro = 1).
THANKS IN ADVANCE
I did the solution...
in the second .qml, just before closing the page, put this:
onIdlibroChanged: { dtCapitulos.query = "select ('Capítulo ' || IdCapitulo) as Capitulo, IdCapitulo, IdVersiculo, Versiculo from CapitulosVers Where IdLibro = " + idlibro + " GROUP BY IdCapitulo ORDER BY IdCapitulo DESC" dtCapitulos.load(); }
onCreationCompleted: { dtCapitulos.load(); }
-
using a drop-down list to power a listview
I try to get a drop-down list selection (newOption) to fuel a sql query to get more information in a listview. The drop down menu works ok, but the list is empty. My dosent sql query recognize newOption and therefore does not feed listview.
Please could you help me with the query syntax. Thank you.
My code is below. If I replace '+' "' + newOption +" ' with a sql table entry, IE 'the cradle', then the listview works very well.
import bb.cascades 1.2
import bb.data 1.0
import com.apiary.data 1.0{Page}
ID: infoPage{Of container
{Label
text: "Info Page".
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: P
}{Drop-down list
ID: dropdown
}{To ListView
ID: apiaryList
dataModel: dataModellistItemComponents:]
{ListItemComponent}
type: 'point '.
{StandardListItem}
ID: apiaryItemTitle: ListItemData.apiary_name
Description: ListItemData.apiary_location
status: ListItemData.apiary_id
}
} / / end of ListItemComponent
]onTriggered: {}
}
}
attachedObjects:]{GroupDataModel}
ID: dataModel2
},
{ComponentDefinition}
ID: optionFactory
Option {}
}
},
DataSource {}
ID: dataSource2
Source: "sql/hood_apiary.db.query: "SELECT * FROM Apiary ORDER BY apiary_name".
onDataLoaded: {}
dataModel2.insertList (data);Now, this is going to populate the drop-down list while reiterating each
the query data and adding one by one to the drop-down list
using the optionFactory component to dynamically add definition
New Options for the drop-down list
for (var i = 0; i)< data.length;="">
{
Create new Option
var newOption = optionFactory.createObject)Set the text of the Option categoryfield (title of the drop-down list)
newOption.text = data .apiary_name [i]
Console.log ("newoption.text =" + newOption.text);Add the Option in the drop-down list
DropDown.Add (newOption);
}
}
},{GroupDataModel}
ID: dataModel
},
DataSource {}
ID: dataSource
Source: "sql/hood_apiary.db.string newOption property
query: "SELECT * FROM Apiary, hive where apiaries.» [apiary_name] = ' "+ newOption +" ' AND Apiary. [apiary_id] = hive. [apiary_id] AND the hive. [apiary_id] is not null ORDER BY hive_id DESC'
onDataLoaded: {}
dataModel.insertList (data);
}
}
]onCreationCompleted: {}
When the display of the list has been created, load the data into the listview
and the drop-down list.
dataSource.load ();
dataSource2.load ();
}
}}
Hello Simon
Thank you very much for your help, you have solved a problem I had for centuries.
{Drop-down list
ID: apiarydropdown
Title: 'select the Apiary.
onSelectedIndexChanged: {}
var dropvalue = apiarydropdown.at ("apiarydropdown.selectedIndex") .text;
Console.log ("dropvalue has been changed to" + dropvalue);
Console.log ("selectedIndex was changed to" + selectedIndex);
dataSource.query = "SELECT * FROM Apiary, hive where apiaries.» [apiary_name] = ' "+ dropvalue +" ' AND Apiary. [apiary_id] = hive. [apiary_id] AND the hive. [apiary_id] is not null ORDER BY hive_id DESC'
dataModel.clear () / / clears all previous listview view
dataSource.load () / / load listview
}
} -
How to upgrade an item in the ListView ListItemComponent
Hello
I have a ListView that uses an ArrayDataModel and a ListItemComponent to display a list of items. One of the elements which is display is a photo that takes place is specified as a URI. In some cases, this URI is empy and I need to go out and scratch a few location data in real time. Within the netscrape2:nEffectuer slot, I am trying to take this new found data (URL location to the new location of the photo) and replace it in my ListView. ListItemComponent...
Any help would be greatly appreciated. Thanks in advance...
Container { leftPadding: 10.0 rightPadding: 10.0 topPadding: 40.0 ListView { function scrapePicture( ExternalUrl, source, mListItemIndexPath ) { console.log("Start Search scrapePicture(): " + ExternalUrl ); console.log("Start Search scrapePicture() Index: " + Index ); netscrape2.scrapeSite(ExternalUrl, source, mListItemIndexPath ); } id: searchListView dataModel: searchDataModel listItemComponents: [ ListItemComponent { id: listComponentSearchResultsListItem type: "" // I do this because its Array datamodel SearchResultsListItem { title: ListItemData.Title pubDate: ListItemData.TimeStamp + " - " + ListItemData.Location previewImage: ( ListItemData.PreviewImage == "" ) ? ListItem.view.scrapePicture( ListItemData.ExternalUrl, ListItemData.Source, ListItem.indexPath ) : ListItemData.PreviewImage } } ] onTriggered: { console.log("Invoke Second Page"); var feedItem = searchDataModel.data(indexPath); // invoke second page... } attachedObjects: [ ScrapeHttp { id: netscrape2 onComplete: { // this is where I want to replace the picture... var data = listComponentSearchResultsListItem.ListItem.view.dataModel.data(netscrape2.mListItemIndexPath); console.log("netscrape2.data: " + data); data.PreviewImage = netscrape2.adImageURL; console.log("netscrape2.data2: " + data); listComponentSearchResultsListItem.ListItem.view.dataModel.replace(0, data); } } ] } // end of ListView
Why all this way?
listComponentSearchResultsListItem.ListItem.view.
The above code is only necessary when you want to access the data of ItemComponent, but you try to change DataModel.
You must change the value in your DataModel, in your case, its ID is searchDataModel. No what you have to do is something like this in your onComplete:
var tmpData = searchDataModel.data(indexPath); tmpData.PreviewImage = netscrape2.adImageURL; searchDataModel.updateItem(indexPath, tmpData);
Now I don't know what is ScrapeHttp, but it sounds like a weird way of this row.
netscrape2.mListItemIndexPath
Maybe you are looking for
-
Chaos of partition after you remove the boot camp partition
Hello guys,. After that I was updating win10 with the new update... that was a bad idea... I tried to do a clean install of it.After failing to do so hard, im really stuck and don't know what to do: boot camp will not let me delete, they 3rd option i
-
HP TouchSmart Desktop PC 600-1120: disable the mouse wheel click
Hello I have a HP TouchSmart 600-1120 Desktop PC, and I want to disable the click of the scroll of the mouse wheel, so it only scrolls up and down and is not clickable. The click is so sensitive, it's difficult to scroll without accidentally clicking
-
I am a newcomer to computing, and you added windows msn and windows live. Ioperate windows vista and hope to have conversations with great kids web cam. But do not know how to run because no instructions are given. Help, please
-
Download touch and non-touch application with the same name
HII I'm doing a new version of an application in the new version of the application, I have two separate release touch and non touch. so create us the same name of the app and app-world as a separate product with a different version and download soun
-
Adobe creativ cloud loads nicht?
ICH habe windows 8.1 habe Schön neugestartet deinstalliert installed als admin gestartet und neu pc are ladet nicht?