myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam.He...@nordlb-it.de
Subject Antwort: Re: [Tobago] sortActionListener not called for dynamic columns
Date Fri, 18 Jan 2008 13:05:37 GMT
Hi Volker,

thanks for the hint and a nice weekend...



kind regards

Adam A. Henne





> Hi Adam,
> 
> at the first quick look:
>  you are removing the dynamic columns in the setDocumentBinding().
>  This method is invoked on every view restore, after this there are no
> colums to invoke the actionListener on.


> Regards,
>     Volker
> 
> 2008/1/17, Adam.Henne@nordlb-it.de <Adam.Henne@nordlb-it.de>:
>> Hi,
>>
>> i'm using <tc:sheet> with the attribute sortActionListener. The sheet
>> contains one static column (<tc:column>) and a dynamic number of
>> supplemental columns. The dynamic columns are added by the binding
>> attribute of the <tc:sheet>.
>>
>> The problem is as followed:
>> The sortActionListener method is ONLY called by clicking on the
>> columnheader of the static column BUT NOT by clicking  on the 
columnheader
>> of one of a dynamic column.
>>
>> What could be the reason? Someone any suggestion? Or is it a bug?
>>
>> ---------------------------------------------
>> JSF-Code:
>> ---------------------------------------------
>> <tc:sheet rows="10"
>>         columns="20px;#{myForm.dynamicColumnsString}"
>>         value="#{myForm.documents}"
>>         var="doc"
>>         selectable="multi"
>>         id="documentsSheet"
>>         showHeader="true"
>>         showDirectLinks="center"
>>         showPageRange="right"
>>         showRowRange="left"
>>         state="#{documentsSheetState}"
>>         sortActionListener="#{myForm.doSortDocuments}"
>>         stateChangeListener="#{myForm.doUpdatePreviewImages}"
>>         binding="#{myForm.documentBinding}">
>>
>>         <tc:column id="index" align="right">
>>                 <tc:out value="#{doc.index}" />
>>         </tc:column>
>>
>> </tc:sheet>
>>
>> ---------------------------------------------
>> Java Code:
>> ---------------------------------------------
>> public UIData getDocumentBinding() {
>>
>>         if (this.ivDocumentSheet == null) {
>>             setDocumentBinding(new UIData());
>>         }
>>
>>         if (ivAttributes != null) {
>>
>>             if (ivDocumentSheet.getChildCount() <= 1) {
>>
>>                 String lvColumnLayout = "20px";
>>                 int lvCnt = 0;
>>                 for (Iterator i = ivAttributes.iterator(); 
i.hasNext();)
>>                 {
>>                     Attribute lvAttribute = (Attribute) i.next();
>>                     UIColumn lvColumn = new UIColumn();
>>                     lvColumn.setLabel(lvAttribute.getName());
>>                     lvColumn.setId("Column" + lvCnt);
>>                     UIOutput lvOut = (UIOutput)
>> 
FacesContext.getCurrentInstance().getApplication().createComponent(UIOutput.COMPONENT_TYPE);
>>                     lvOut.setRendererType("Out");
>>
>>                     String lvBindingString = "#{doc.value" + lvCnt + 
"}";
>>                     ValueBinding lvBinding =
>> 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lvBindingString);
>>                     lvOut.setValueBinding("value", lvBinding);
>>
>>                     lvColumn.getChildren().add(lvOut);
>>                     lvColumn.setSortable(true);
>>                     lvColumn.setAlign("center");
>>
>>                     ivDocumentSheet.getChildren().add(lvColumn);
>>                     lvColumnLayout += ";100px";
>>                     lvCnt++;
>>                 }
>>                 ivDokumentDetailsSheet.setColumns(lvColumnLayout);
>>             }
>>         }
>>         return this.ivDocumentSheet;
>> }
>>
>> public UIData getDocumentBinding() {
>>
>>         if (this.ivDocumentSheet == null) {
>>             setDocumentBinding(new UIData());
>>         }
>>
>>         if (ivAttributes != null) {
>>
>>             if (ivDocumentSheet.getChildCount() <= 1) {
>>
>>                 String lvColumnLayout = "20px";
>>                 int lvCnt = 0;
>>                 for (Iterator i = ivAttributes.iterator(); 
i.hasNext();)
>>                 {
>>                     Attribute lvAttribute = (Attribute) i.next();
>>                     UIColumn lvColumn = new UIColumn();
>>                     lvColumn.setLabel(lvAttribute.getName());
>>                     lvColumn.setId("Column" + lvCnt);
>>                     UIOutput lvOut = (UIOutput)
>> 
FacesContext.getCurrentInstance().getApplication().createComponent(UIOutput.COMPONENT_TYPE);
>>                     lvOut.setRendererType("Out");
>>
>>                     String lvBindingString = "#{doc.value" + lvCnt + 
"}";
>>                     ValueBinding lvBinding =
>> 
FacesContext.getCurrentInstance().getApplication().createValueBinding(lvBindingString);
>>                     lvOut.setValueBinding("value", lvBinding);
>>
>>                     lvColumn.getChildren().add(lvOut);
>>                     lvColumn.setSortable(true);
>>                     lvColumn.setAlign("center");
>>
>>                     ivDocumentSheet.getChildren().add(lvColumn);
>>                     lvColumnLayout += ";100px";
>>                     lvCnt++;
>>                 }
>>                 ivDokumentDetailsSheet.setColumns(lvColumnLayout);
>>             }
>>         }
>>         return this.ivDocumentSheet;
>> }
>>
>>
>> public void setDocumentBinding(UIData pvTable)
>> {
>>         this.ivDocumentSheet = pvTable;
>>         if (ivDocumentSheet.getChildren().size() > 1)
>>         {
>>             int lvColumnSize = ivDocumentSheet.getChildCount();
>>             for (int i = 1; i < lvColumnSize; i++) {
>>                 ivDocumentSheet.getChildren().remove(1);
>>             }
>>             ivDocumentSheet.setColumns("");
>>         }
>>         this.getDocumentBinding();
>> }
>>
>>
>>
>>
>>
>>
>> kind regards
>>
>> Adam A. Henne
>>
>>


-- 
inexso - information exchange solutions GmbH
Bismarckstra├če 13      | 26122 Oldenburg
Tel.: +49 441 4082 356 |
FAX:  +49 441 4082 355 | www.inexso.de


Mime
View raw message