• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Assigning editable attribute of sjg:gridColumn at runtime

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
with ognl:


Johannes
 
coder codey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sure Bear

I will be careful from next time ..
 
Johannes Geppert
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
your property is called isEditable but you don't reference it.



Johannes
 
coder codey
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My Apologies Johannes that was a typo. I am refering the same property name that i am defining in my Action class.

Thanks
Anshul
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic