Hi there,

I have a strange problem with a datatable that I am generating on the fly
(since the user may choose the columns they wish to appear). It all appears
to be working just fine, except for the sortation under certain
circumstances. 

On first load of the page, all sortation works without an issue, however if
the user chooses one of the records in the table, they are diverted to a
page where that record may be edited, using an action event to find the
record followed by an action that does the redirect. If the user then hits
the back button in the browser and chooses to sort once more, they are
redirected back to the edit screen they have just been on. When I add a
'manual' column into the jsp page code, and choose to sort that column
following the 'back' browser action, the sortation works without an issue. 

I am using a tomahawk snapshot from 12/01/2007 in conjunction with myfaces
1.1.4. I have tried debugging this situation and the only difference I can
see between the properties of the columns generated dynamically and the
column I added manually is the component attributes map and the default
sorted attribute is null for the dynamically created columns.

The code used to create the columns dynamically is:

UIColumn col = new HtmlSimpleColumn();
UIOutput header = new HtmlOutputText();
HtmlCommandSortHeader csh = new HtmlCommandSortHeader();

col.setId("ExampleID");
header.setValue("Headng Name Example");
Class args[] = {ActionEvent.class};
csh.setColumnName(src.getSortationField());
MethodBinding mb =
getFacesContext().getApplication().createMethodBinding("#{BackingBean.gotoFirstPage}",
args);

csh.setActionListener(mb);
csh.getChildren().add(header);
col.setHeader(csh);

UIOutput outputValue = new HtmlOutputText();
ValueBinding vbStandard =
getFacesContext().getApplication().createValueBinding("#{prefix.fieldExample}");
outputValue.setValueBinding("value", vbStandard);
col.getChildren().add(standardValue);

_MyDataTable.getChildren().add(col);

I have tried removing the action listener associated with the heading but
that makes no difference.

Has anybody come across this situation at all? Any help/suggestions would be
hugely appreciated.

Thanks in advance, 

Carl




-- 
View this message in context: 
http://www.nabble.com/Dynamic-Datatable-CommandSortHeader-Problem-tf3136188.html#a8690295
Sent from the MyFaces - Users mailing list archive at Nabble.com.

Reply via email to