Using TableEditor to view a list of object instances

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using TableEditor to view a list of object instances

Brennan Williams
Just looking for a bit of guidance on using TableEditor....

Say I have a 'model' which has a list of 'dataset' objects, each of
which has a list of 'variable's. Each variable has a user defined 'name'
and a 'value'. All the datasets in the model have the same list of
variables, (same variable names but different values form dataset to
dataset).

I want to use TableEditor to display in each row the dataset name and
the values of each variable.

So my column names are 'dataset name','variable 1 name','variable 2
name', ....

Typically when I use TableEditor I have explicit trait names in my
column definitions but in this case they are coming from
variablelist=List(Instance('Variable'))

So if I have ....

     def create_table_editor(self):
         tableeditor=TableEditor(....)
         column=MyObjectColumn(name='?',editable=False,label='?',width=0.1)
etc.

how do I correctly set up the name and the label?

Do I possibly need to create some sort of temporary viewmodel object,
e.g. DatasetVariableViewModel?

Any help appreciated.

Brennan

_______________________________________________
Enthought-Dev mailing list
[hidden email]
https://mail.enthought.com/mailman/listinfo/enthought-dev