You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by dushyant agarwal <ag...@yahoo.co.in> on 2008/07/08 11:58:49 UTC

[TRINIDAD]How to set readOnly=true on an inputText inside a tree table?

Hi,
I have a JSF page in which there is a treeTable component. In one of the columns (which is not within node stamp or path stamp facets) is an inputText component. I want to set Readonly =true on inputTexts corresponding rows on level one(may be apply a different style on those rows as well). On debugging the page I found the client id's of all the rendered inputTexts(for level 1) to be starting with treetable1:0 and treeTable1:1. So I wrote,

UIComponent treeTbl= facesContext.getViewRoot().findComponent("treeTable1");
List lst = treeTbl.getChildren();
for(int i=0;i<lst.size();i++){
UIComponent column = lst.get(i);
  List lst1 = column.getChildren();
   for(int j=0;i<lst1.size();j++){
   UIComponent colChild= lst.get(j);
     if(colChild instanceof CoreInputText){
/*
Over here the client id is coming out to be treeTable1:inputText1
How can I get the components for level 1i.e."treeTable1:0:" and "treeTable1:1:"
*/
       if(colChild .getClientId(facesContext).startsWith("treeTable1:0:")){
         ((CoreInputText)colChild).setReadOnly(true);
}
}
}
}

Thanks,
Dushyant




      Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/

Re: [TRINIDAD]How to set readOnly=true on an inputText inside a tree table?

Posted by Andrew Robinson <an...@gmail.com>.
You need to set the row index of the table to access a child component
in the scope of a given node.

"treeTable1:1" means treeTable1 component, row 1.

-Andrew

On Tue, Jul 8, 2008 at 3:58 AM, dushyant agarwal
<ag...@yahoo.co.in> wrote:
> Hi,
> I have a JSF page in which there is a treeTable component. In one of the
> columns (which is not within node stamp or path stamp facets) is an
> inputText component. I want to set Readonly =true on inputTexts
> corresponding rows on level one(may be apply a different style on those rows
> as well). On debugging the page I found the client id's of all the rendered
> inputTexts(for level 1) to be starting with treetable1:0 and treeTable1:1.
> So I wrote,
>
> UIComponent treeTbl= facesContext.getViewRoot().findComponent("treeTable1");
> List lst = treeTbl.getChildren();
> for(int i=0;i<lst.size();i++){
> UIComponent column = lst.get(i);
>   List lst1 = column.getChildren();
>    for(int j=0;i<lst1.size();j++){
>    UIComponent colChild= lst.get(j);
>      if(colChild instanceof CoreInputText){
> /*
> Over here the client id is coming out to be treeTable1:inputText1
> How can I get the components for level 1i.e."treeTable1:0:" and
> "treeTable1:1:"
> */
>        if(colChild .getClientId(facesContext).startsWith("treeTable1:0:")){
>          ((CoreInputText)colChild).setReadOnly(true);
> }
> }
> }
> }
>
> Thanks,
> Dushyant
>
>
> ________________________________
> Meet people who discuss and share your passions. Join them now.