NTNUJAVA Virtual Physics Laboratory
Enjoy the fun of physics with simulations!
Backup site http://enjoy.phy.ntnu.edu.tw/ntnujava/

Easy Java Simulations (2001- ) => Questions related to EJS => Topic started by: Fred Chuit on October 10, 2009, 01:37:14 am



Title: how to format columns of datatable
Post by: Fred Chuit on October 10, 2009, 01:37:14 am
Dear EJS-users,

I have a problem when using a datatable.
It is a datatable with 3 columns.
I want to format the output of all columns on 1 decimal numbers (3.9 for instance).
When I put 0.0 in the ColumnFormat only the first column is formatted in 1 decimal, the other colums still have 3 decimals.
How can I fix this?
Already thanks for any help and advice.
Regards,
Fred


Title: Re: how to format columns of datatable
Post by: lookang on October 10, 2009, 08:11:54 am
Please attach your XML so that other ejs users can immediately understand your question.
I have not tried tables formatting. :)


Title: Re: how to format columns of datatable
Post by: Fred Chuit on October 10, 2009, 08:40:36 pm
I used the DataTable example from the ejs help-pages.
I include the example I use.
Alas I can not manage to format the last column, this one always is 3 decimals.
What to do to format all columns.
I would be grateful for any help or advice.
Regards,
Fred


Title: Re: how to format columns of datatable
Post by: lookang on October 11, 2009, 08:32:41 am
i figure out the formatting
column names
new String[]{"#","t","x","C"}
column format
new String[]{"0.0","0.0","0.0","0.0"}

i will add this into the wiki http://www.um.es/fem/EjsWiki/Main/ElementsDataTable

i see u are exploring Ejs, great man, keep it up. ;D


Title: Re: how to format columns of datatable
Post by: Fred Chuit on October 12, 2009, 09:05:20 pm
Dear mr. Lookang,

Thanks for your help. You are fast in finding the solution.
Now I can continue with the applet.
Again many thanks!
Regards,
Fred