• 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

Dynamic TaleColumn

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone!

I've problem related with data binding for webuijsf:table, I've array in sessionBean of my custom class objects, but but..., the thing is that I can just bind columns to value like:

currentRow.value['name']

but what if i've array inside of each custom objects and i want to split data from array to different columns,

for example:

Object Person[] (SessionBean) ==> bind to table

in class Person:
{
String notesStr[] = {"note 1","note 2","note 3"};
}

so how i suppose to get value from table using currentRow.value[] syntax? like: currentRow.value[noteStr[0]] ?? (it's not working at all...)

in backing bean I created sample code to support dynamic table, but works with single variables not with String array..:


FacesContext fc = FacesContext.getCurrentInstance();
ValueExpression ve = fc.getApplication().getExpressionFactory().createValueExpression(fc.getELContext(), "#{currentRow.value['testStr']}", String.class);

if (!columnInView) {
TableColumn col1 = new TableColumn();
col1.setVisible(true);
col1.setRendered(true);
col1.setHeaderText("DynCol1");
col1.setId("dynCol1");
// col1.setSort("desc");

StaticText st = new StaticText();
st.setValueExpression("value", ve);
col1.getChildren().add(st);

tprogress.getTableRowGroupChild().getChildren().add(col1);
}


cheers

Walter


 
Walter Krawiec
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
anyone ?
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can try currentRow.value.noteStr[0]
 
Walter Krawiec
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kavita Tipnis wrote:You can try currentRow.value.noteStr[0]



Thank you mate!

it's working fine, you saved my time ( I was about to build an extra data provider).

You are great!

cheers
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just happened to deal with similar EL expressions earlier ;)
JSF EL is good yet a little confusing because it differs slightly for each framework.
 
reply
    Bookmark Topic Watch Topic
  • New Topic