1

I am using primefaces resizable in my application. i know if we set containment=true the containment would be the parent of the component. but i want my component to be contained with in the grandparent below is the code :

  <p:dataTable id="tab" value="#{listOfDays}">
   <p:column>
    <h:outputText value="#{day}"/> //from MON to SUN
   </p:column>
   <p:column>
  <p:outputPanel id="pnl">
  <ui:repeat id="loop" value="somelist">
  <p:commandLink id="link"/>
  <p:resizable for="link" listener="#{calllistener}" containment="true"/>
  </ui:repeat>
  </p:outputPanel>
   </p:column>
   </p:dataTable>

i want commandlink to be restricted to outputPanel when resized. as i set containment to true it is restricted to ui:repeat as it is the closet parent of the commandlink. so, is there any way that i can restrict the commandlink to the grandparent i.e., outputPanel in this case when commandlink is resized??

EDIT I am able to set the components parent in the backing bean like this

     public void handleResize(ResizeEvent event){
         if(first time) {
         resizable =(Resizable)(event.getComponenet());
          resizable.setParent(event.getParent().getParent());
          }
         sysout(resizable.getClientId()); 
     }

i can print the client id of the parent on resize but it is not being contained within the grandparent. any help is greatly appreciated.

edit lemme make it clear what i am trying to achieve. i am trying to create a time scheduler (not the scheduler component in prime faces)

in the code, the outputpanel has an image which represents time from 00:00 to 23:59 the outputpanel can have any number of commandLinks thus ui:repeat. commandlink represent time interval say for instance from 12:00 to 20:00 and we can also change the time interval thus resizable. i dont want the timeinterval(commandlink) to go out of outputPanel.

thanks in advance :)

PermGenError
  • 45,977
  • 8
  • 87
  • 106

1 Answers1

1

You can get a component clientId with #{component.clientId}

fore more info see here : How to refer to a JSF component Id in jquery?

Retrieving other component's client ID in JSF 2.0

http://java.dzone.com/articles/jsf-20-clientid-jquery

Community
  • 1
  • 1
Mehdi
  • 4,396
  • 4
  • 29
  • 30
  • thanks for your reply, i am not using jquery resizable. i am using primefaces resizable. i know in jquery we can set resizable to parents parent like $(selc).resizable( {containment:$(selector).parent().parent()}); but i need to do the same using primefaces resizable tag . – PermGenError Aug 30 '12 at 11:43
  • I know, `#{component.clientId}` is for generated ID by JSF. You wanted to have access to generate ID by JSF, right? – Mehdi Aug 30 '12 at 12:30
  • not exactly. i do not have any problem with the id's. i want commandlink when resized to be ristricted to outputPanel. usually we give containment = true in resizable which restricts the commandLink to its nearst parent i.e., in this case ui:repeat. – PermGenError Aug 30 '12 at 12:58
  • Your welcome, happy to see that they helped you. And I understood your problem. I'm not a jQuery guru but think that if you do it completely client side using jQuery, it's easier to handle. – Mehdi Aug 30 '12 at 19:54