zhoupan / jmesa

Automatically exported from code.google.com/p/jmesa
0 stars 0 forks source link

Set Cell Value Externally #316

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I need to programmatically modify cells in a jMesa Worksheet. To be more 
specific, I need the user to be able to modify "ColumnX" in multiple rows at 
once by having users select which rows they would like to edit (using the 
checkbox column) and then systematically setting the value of "ColumnX" in the 
Worksheet to a new value for each of the selected rows. Is this possible?

I tried to create a custom cell editor on "ColumnX" that will set the cell to 
the desired value if the checkbox column in the same row is checked in the 
Worksheet but I cannot find a way to get at the checkbox status in the 
Worksheet.

I would imagine that the ability to write macros such as this to modify the 
Worksheet without requiring users to explicitly click on a cell would be very 
useful in many other instances as well so I am very determined to find a 
solution.

Thank you for any help you can offer!   

Original issue reported on code.google.com by Square...@gmail.com on 16 May 2011 at 8:50

GoogleCodeExporter commented 9 years ago
Technically you can get at the worksheet in the users session. It is in there 
keyed by the table id + "_WORKSHEET". From a cell editor you can get at the 
users session from the WebContext object, which is available if you extend from 
the AbstractCellEditor. You could also create a SessionWorksheetState object 
and interact with that to avoid hardcoding the key.

If you want a checkbox that does not link to a column you can create a dummy 
column (meaning defining a column property that is not part of your java 
object).

Not sure if that really gets you what you want. What you would really want is 
spreadsheet-like functionality that lets you highlight a bunch of column 
rows...but that is beyond the scope of what JMesa does out of the box.

Maybe you could have something like a mass update wizard. Something like select 
a bunch of rows, and then you go into a modal wizard that lets you select the 
columns that you want to update, hit next, and then enter values. In that case 
the checkbox values would not have to be in the worksheet as you could pass the 
id's right to the modal. You would still create a custom cell editor but just 
to give you a checkbox and maybe some JavaScript to start up the modal. Then 
take the values that the user enters and place them in the Worksheet.

Original comment by jeff.johnston.mn@gmail.com on 17 May 2011 at 1:23

GoogleCodeExporter commented 9 years ago
If you do a modal (popup div) you would still want to refresh the page (table). 
If you go to another page you could return to the page in the way the user left 
it by using the State feature.

Original comment by jeff.johnston.mn@gmail.com on 17 May 2011 at 1:26

GoogleCodeExporter commented 9 years ago
Thanks Jeff!

I was able to do exactly what I wanted once I was able to get at the worksheet 
so thank you for the advice and for creating such a great tool!

Original comment by Square...@gmail.com on 19 May 2011 at 11:00