Discussion:
How do I access a list item?
(too old to reply)
Tomás Antunes
2016-03-29 12:00:34 UTC
Permalink
How do I access a list item in this event?

self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
Norbert Schroeder
2016-03-29 12:23:08 UTC
Permalink
The variable "selection" in your example is an array with all selected list items, i.e. selection[0] gives you the first selected item.

Regards,

Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
Tomás Antunes
2016-03-29 13:20:27 UTC
Permalink
No, that doesn't seem to be the case. When I print the selection variable I
get a single integer which corresponds to the iterator of the list.

When I try to run this code the function isn't defined:

self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
selection.addCssClass('item-selected'); // error
}, this);
Post by Norbert Schroeder
The variable "selection" in your example is an array with all selected
list items, i.e. selection[0] gives you the first selected item.
Regards,
Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
John Spackman
2016-03-29 13:27:56 UTC
Permalink
Hi Tomas

e.getData() will return an instance of qx.data.Array, which is the selection; what you want to do is access selection.getItem(0) to get an instance of qx.ui.form.ListItem.

If you still have problems, please can you create an example in the playground? It’s much easier to help out if we can all share the same working example

Regards
John

From: "qooxdoo Development <qooxdoo-***@lists.sourceforge.net>" <qooxdoo-***@lists.sourceforge.net> on behalf of Tomás Antunes <***@gmail.com>
Date: Tuesday, 29 March 2016 at 14:20
To: "qooxdoo-***@lists.sourceforge.net" <qooxdoo-***@lists.sourceforge.net>
Subject: Re: [qooxdoo-devel] How do I access a list item?

No, that doesn't seem to be the case. When I print the selection variable I get a single integer which corresponds to the iterator of the list.

When I try to run this code the function isn't defined:

self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
selection.addCssClass('item-selected'); // error
}, this);

On Tue, Mar 29, 2016 at 1:23 PM, Norbert Schroeder <***@scro34.de> wrote:
The variable "selection" in your example is an array with all selected list items, i.e. selection[0] gives you the first selected item.

Regards,

Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
Tomás Antunes
2016-03-29 13:39:41 UTC
Permalink
All right here is the demo http://tinyurl.com/jqc5a5w

Still getting error.
Post by Norbert Schroeder
The variable "selection" in your example is an array with all selected
list items, i.e. selection[0] gives you the first selected item.
Regards,
Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Norbert Schroeder
2016-03-29 13:54:15 UTC
Permalink
Ah, you're on qx.mobile, I assumed qx.desktop (qx.ui.form.list). Can't help you there, I'm entirely immobile.

Regards,

Norbert
All right here is the demo http://tinyurl.com/jqc5a5w <http://tinyurl.com/jqc5a5w>
Still getting error.
Post by Norbert Schroeder
The variable "selection" in your example is an array with all selected list items, i.e. selection[0] gives you the first selected item.
Regards,
Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 <http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140>
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel <https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel>
Derrell Lipman
2016-03-29 14:08:25 UTC
Permalink
Here's how you do it on qx.mobile.

http://tinyurl.com/h2eqtrq

Derrell
Post by Norbert Schroeder
Ah, you're on qx.mobile, I assumed qx.desktop (qx.ui.form.list). Can't
help you there, I'm entirely immobile.
Regards,
Norbert
All right here is the demo http://tinyurl.com/jqc5a5w <
http://tinyurl.com/jqc5a5w>
Still getting error.
On Tue, Mar 29, 2016 at 1:23 PM, Norbert Schroeder <
Post by Norbert Schroeder
The variable "selection" in your example is an array with all selected
list items, i.e. selection[0] gives you the first selected item.
Post by Norbert Schroeder
Regards,
Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
------------------------------------------------------------------------------
Post by Norbert Schroeder
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140 <
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140>
Post by Norbert Schroeder
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel <
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel>
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
qooxdoo-devel mailing list
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
John Spackman
2016-03-29 14:01:39 UTC
Permalink
Aha, yes me too – I assumed you were on desktop too.

I’ve had a look at the code for mobile and AFAICT the item is not made available; the preferred method is to change the underlying model and ask the list to redraw itself. Here’s an example: http://tinyurl.com/hy2xzmh

John

From: "qooxdoo Development <qooxdoo-***@lists.sourceforge.net>" <qooxdoo-***@lists.sourceforge.net> on behalf of Tomás Antunes <***@gmail.com>
Date: Tuesday, 29 March 2016 at 14:39
To: "qooxdoo-***@lists.sourceforge.net" <qooxdoo-***@lists.sourceforge.net>
Subject: Re: [qooxdoo-devel] How do I access a list item?

All right here is the demo http://tinyurl.com/jqc5a5w

Still getting error.

On Tue, Mar 29, 2016 at 1:23 PM, Norbert Schroeder <***@scro34.de> wrote:
The variable "selection" in your example is an array with all selected list items, i.e. selection[0] gives you the first selected item.

Regards,

Norbert
Post by Tomás Antunes
How do I access a list item in this event?
self.myList.addListener("changeSelection", function(e) {
var selection = e.getData();
console.log(self.myList.getSelection()[selection]);
}, this);
Daniel Lenggenhager
2016-03-29 14:05:06 UTC
Permalink
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140

Loading...