wood burning stoves 2.0*
The moose likes Struts and the fly likes Assigning editable attribute of sjg:gridColumn at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Assigning editable attribute of sjg:gridColumn at runtime" Watch "Assigning editable attribute of sjg:gridColumn at runtime" New topic
Author

Assigning editable attribute of sjg:gridColumn at runtime

coder codey
Greenhorn

Joined: Jan 13, 2011
Posts: 5
Hi All

I am using the Struts2 jquery grid and I have a requirement where in i have to make a cell editable or non-editable based on the value of that cell whether the value is empty or it has some value.



Above in this grid , my grid model is "shippingDetailResultList ". Now this is a list of beans. So in my action class i have this list defined as :

private List<ShipmentResultModel> shippingDetailResultList; . ShipmentResultModel is the model bean that has the properties that are used for grid (eg: nr, partId, trackingNumber etc.).

Now there are cases where in for one model object the trackingNumber is null . So if the tracking number is null i need to make the tracking Number cell in my grid editable else it has to be non-editable.

I tried to look around all the forums but i couldn't find anything related to it.

Does the "editable" accepts runtime values, if yes how can we do that ?
Also i tried using <s:if><s:else> statements where i tried to check if the value is null then i will have the grid as



But i am not getting as to how to get the values in the "test" attribute i.e how to get hold of the trackingNumber property of the ShipmentResultModel.

Any help is really appreciated as this has become a bottle neck for me.

Thanks
Anshul
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
with ognl:


Johannes


My Java and Webprogramming Blog
coder codey
Greenhorn

Joined: Jan 13, 2011
Posts: 5
Johannes Geppert wrote:with ognl:


Johannes



Hi JOhannes

Thanks for the reply !! ..
I have a question , with ognl you mean i shall have a property called isEditableAttribute in my model(ShipmentResultModel) class and set it to true or false based on whether the trackingNumber is empty or not ?

Anshul
coder codey
Greenhorn

Joined: Jan 13, 2011
Posts: 5
Sure Bear

I will be careful from next time ..
Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
coder codey wrote:I have a question , with ognl you mean i shall have a property called isEditableAttribute in my model(ShipmentResultModel) class and set it to true or false based on whether the trackingNumber is empty or not ?


no this not dependent from your model this means an attribute from your action.
If you like to make it dependent from the model you should take a look at the topics.
Maybe you have success with onEditInlineBeforeTopics.
coder codey
Greenhorn

Joined: Jan 13, 2011
Posts: 5
Hi Johannes

I tried using the approach you suggested but it didn't work. In my Action Class i have a property called isEditable and i am setting it to true.

Then in my gridColumn i set the column as


but always the column is coming as non editable. Can you suggest what could be wrong here !!

Thanks

Johannes Geppert
Ranch Hand

Joined: Jan 12, 2010
Posts: 67
your property is called isEditable but you don't reference it.



Johannes
coder codey
Greenhorn

Joined: Jan 13, 2011
Posts: 5
My Apologies Johannes that was a typo. I am refering the same property name that i am defining in my Action class.

Thanks
Anshul
 
jQuery in Action, 2nd edition
 
subject: Assigning editable attribute of sjg:gridColumn at runtime
 
Similar Threads
struts2 with Jquery javascript issue
Struts-JQuery grid, how to set font-size to the title of each grid column?
[Jqueryplugin] [struts2] rendering grid
[Struts2][Jqueryplugin] problem to populate grid .
struts-jquery-grid-tags and i18n