You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by guillaume bouichet <bo...@yahoo.fr> on 2006/07/13 07:47:41 UTC
HtmlDataTable and HtmlCommandLink
I'm trying to render dynamic HtmlDataTable with HtmlCommandLink as rows :
//my binding with my jsp is on HtmlPanelGrid grid
Application app = FacesContext.getCurrentInstance().getApplication();
HtmlPanelGrid grid = new HtmlPanelGrid();
List children = grid.getChildren();
HtmlDataTable dataTableComponent = new HtmlDataTable();
String simpleName = classModele.getSimpleName();
dataTableComponent.setVar(simpleName);
...
for (each columns) {
//Populate with UIColumn , it works fine
}
//Last column
UIColumn columnComponent = new UIColumn();
HtmlOutputText headerComponent = new HtmlOutputText();
headerComponent.setValue("MAJ");
columnComponent.setHeader(headerComponent);
HtmlCommandLink htmlCommandLink=(HtmlCommandLink)app.createComponent (HtmlCommandLink.COMPONENT_TYPE);
htmlCommandLink.setValue("Update");
Class[] argTypes = {ActionEvent.class };
MethodBinding vb=FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{renderer.update}", argTypes);
htmlCommandLink.setActionListener(vb);
MethodBinding mb = app.createMethodBinding("#{renderer.updateLine}",null);
htmlCommandLink.setAction(mb);
columnComponent.getChildren().add(htmlCommandLink);
childrenList.add(columnComponent);
// Then populate with data , work fine too.
The problem, is when I click on the html link no action is called, it just return to my original page ( my htmldatatable) with no data :-(
I've tried different ways but it always do the same.
I only succeed once but not programmatically ( just like http://www.oracle.com/technology/products/jdev/101/howtos/jsfdrilldown/index.html )
I think it's the same problem as : http://marc2.theaimsgroup.com/?l=myfaces-user&m=114106477925143&w=2
Guillaume
Re: HtmlDataTable and HtmlCommandLink
Posted by "ved.gunjan" <ve...@yahoo.com>.
Hi Guillaume,
Im running in to similar kind of probelm..in fact my problem is worse....my requirment is that i have to create a dynamic datatable and which contains listing of question and and respectives answer. these questions and answer come from the server and along with the answer i also get the answer type , which tells what is the type of the UIComponent that is associated with the answer, so i have to dynamically create these UIComponent inside the datable.
My problem is that im not able to create this componets.
After going through your code below, it seems that u are doing similer kind of stuff.
Can u please provide me the entire java method which creates the uicomponents along with the jsp.
it will be greate if can help me out as im really in a bad shape.
looking forward for a positive response.
Thanks
ved
guillaume bouichet <bo...@yahoo.fr> wrote:
I'm trying to render dynamic HtmlDataTable with HtmlCommandLink as rows :
//my binding with my jsp is on HtmlPanelGrid grid
Application app = FacesContext.getCurrentInstance().getApplication();
HtmlPanelGrid grid = new HtmlPanelGrid();
List children = grid.getChildren();
HtmlDataTable dataTableComponent = new HtmlDataTable();
String simpleName = classModele.getSimpleName();
dataTableComponent.setVar(simpleName);
...
for (each columns) {
//Populate with UIColumn , it works fine
}
//Last column
UIColumn columnComponent = new UIColumn();
HtmlOutputText headerComponent = new HtmlOutputText();
headerComponent.setValue("MAJ");
columnComponent.setHeader(headerComponent);
HtmlCommandLink htmlCommandLink=(HtmlCommandLink)app.createComponent (HtmlCommandLink.COMPONENT_TYPE);
htmlCommandLink.setValue("Update");
Class[] argTypes = {ActionEvent.class };
MethodBinding vb=FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{renderer.update}", argTypes);
htmlCommandLink.setActionListener(vb);
MethodBinding mb = app.createMethodBinding("#{renderer.updateLine}",null);
htmlCommandLink.setAction(mb);
columnComponent.getChildren().add(htmlCommandLink);
childrenList.add(columnComponent);
// Then populate with data , work fine too.
The problem, is when I click on the html link no action is called, it just return to my original page ( my htmldatatable) with no data :-(
I've tried different ways but it always do the same.
I only succeed once but not programmatically ( just like http://www.oracle.com/technology/products/jdev/101/howtos/jsfdrilldown/index.html )
I think it's the same problem as : http://marc2.theaimsgroup.com/?l=myfaces-user&m=114106477925143&w=2
Guillaume
---------------------------------
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail Beta.