Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Zmey
Posts: 1,512
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: Item add dual into SystemListDialog

When appending these values to SystemListDialog, the values are known and they are appended in particular order.

 

To retrieve the value later you can map the index to original data. If original data is no longer accessible, you can store the values in an array temporarily, for example:

 

// pseudo-code written in browser to show the idea, may contain errors

 

Page {
  property variant myValues

...

// When appending the values to SystemListDialog:

var tmp = []
for (var i = 0; i < someContainer.length; ++i) {
  var value = someContainer[i]
  listDialog.appendItem(value)
  tmp.push(value)  // also add it to array
}
myValues = tmp

...

// Map them back:

if (selectedIndices.length > 0) {
  var index = selectedIndices[0]
  var text = myValues[index]
}

 

 I hope this helps.

 

There is no API to access the values in SystemListDialog directly.

 


Andrey Fidrya, @zmeyc on twitter