Skip to main content

action in a Table

1 reply [Last post]
ferdinandogranelli
Offline
Joined: 2007-11-20
Points: 0

How can I use " onSelectionChange: function():* " to save the row/column clicked by user ?

Please show me some code samples.
Thanks in advance!

p.s.
my code :
var modelTable = TableDemoModel {
people:
[Person {
Sender: "Mary Bon"
Email: "Campione@gmail.com"
Subject: "Snowboarding"
EmailText: "Mail 1"
Read: false
} ] // a lot ot Person...

[Table {
onSelectionChange : [ ] //???
columns:
[TableColumn {
text: "Sender"
},
TableColumn {
text: "Email"
},
TableColumn {
text: "Subject"
width: 100

}]

cells: bind foreach (p in modelTable.people)

[TableCell {
text:bind p.Sender
selected: bind p.selected
},
TableCell {
text:bind p.Email
selected: bind p.selected
},
TableCell {
text: bind p.Subject
selected: bind p.selected

}
]}
]}

I must insert in a TextPane the Email of the Person selected in the Table !!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
alexsch
Offline
Joined: 2007-07-12
Points: 0

It is better to use the Table selection attribute and triggers like this:

[code]
class TableDemoModel {
attribute people: Person*;
attribute selection: Number;
}

trigger on TableDemoModel.selection=value{
if(value <> -1){
println("person: {people[value]}");
}
}

Table {
selection: bind modelTable.selection
// columns:
// cells: bind foreach(p in modelTable.people) ...
}
[/code]