• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic TaleColumn

 
Walter Krawiec
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone ?
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can try currentRow.value.noteStr[0]
 
Walter Krawiec
Greenhorn
Posts: 20
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic