Found the error. I was setting the property VAR_KEY to the wrong value. Below
is the corrected table.setValueExpression()
table.setValueExpression(CoreTable.VAR_KEY.getName(),
ef.createValueExpression(elContext,
"row", Object.class));
Now the VAR_KEY property matches the EL in the column value, #{row.column_0}.
Paul Spencer
On Jun 1, 2011, at 8:42 PM, Paul Spencer wrote:
> Trinidad v2.0.0
>
> I am creating a table in Java and saving as the managed bean #{dynamicTable}.
> Setting the "Value" property is working, by the "Var" does not. I know
> this because table displays a number of blank rows that matches the number of
> objects in #{dataRows}. The tag used to display the table is below:
> <tr:table id="table" binding="#{dynamicTable}"/>
>
> Alternatively, when I add 'var="row"' to the table tag, the table data is
> displayed as expected:
> <tr:table id="table" binding="#{dynamicTable}" var="row"/>
>
> Below is how I am setting the "Var" and "Value" properties on the CoreTable
> object.
>> FacesContext context = FacesContext.getCurrentInstance();
>> ELContext elContext = context.getELContext();
>> Application app = context.getApplication();
>> ExpressionFactory ef = app.getExpressionFactory();
>>
>> CoreTable table = new DynamicTableBean();
>> table.setValueExpression(CoreTable.VAR_KEY.getName(),
>> ef.createValueExpression(elContext,
>> "var", Object.class));
>> table.setValueExpression(CoreTable.VALUE_KEY.getName(),
>> ef.createValueExpression(elContext,
>> "#{dataRows}", Object.class));
>>
>
> Below is how I dynamically set the column value.
>>
>> ValueExpression columnValue = ef.createValueExpression(elContext,
>> "#{row.column_" + i + "}",
>> Object.class);
>> outputText.setValueExpression(VALUE_KEY.getName(), columnValue);
>>
>
>
> Am I setting the correct property for the row variable?
>
> Paul Spencer
>