(Dartlang) How can I detect the selected item in the listview

914 Views Asked by At

rikulo.org has great example for list-view at
http://rikulo.org/resource/js/examples/index-list.html

In this example, how can I detect the selected items in the list?
For example, how do I know 'Row 5' is selected if I click or touch on 'Row 5' ?

2

There are 2 best solutions below

0
On
  1. You can listen to onClick events for each list item by

    item.on.click.add((ViewEvent event) { // do whatever you want, handle selection, add/remove CSS class, etc });

  2. Or add a checkbox within the list item, and listen to its onCheck event.

Note that Rikulo is under rapid development now and will add more construction. There will be a model driven list view that handles selection.

0
On

It works for me:

document.onClick.listen((MouseEvent e){
   TableRowElement row = e.toElement;
   print(row.text);
 });

You can change document to : query("#table"), queryAll("tr"),ect