Hello people there :-),

I have a solution through the use of actionListener instead of action:

public void updatePhoneType( ActionEvent event ) {
 UIData data = findComponent( UIData.class,
"page:personForm:details:phoneListSubview:phones" );
 PhoneNumber number = (PhoneNumber) data.getRowData ();
 UIComponent component = event.getComponent();
 String type = (String) component.getAttributes().get( "phoneType" );
 number.setType( PhoneType.valueOf( type ) );
}

But using an action listener instead of an action isn't a very good solution
since I loose control on redirecting the result to another page.

I have also another problem:
Error : LOG.debugAjaxComponents is not a function
Fichier source :
http://localhost:8080/IntoServicesTobagoWeb/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
Line : 702

when I try to enable "renderedPartially". here is my jsp snippet:
 <tc:sheet id="phones" columns="18px;15*;18px;18px"
  value="#{personCtrl.current.bean.phones}" var="phone">
  <tc:column sortable="true">
   <tc:menuBar id="phoneTypeMenuBar">
    <tc:menu id="phoneTypeMenu" image="image/phone_types/#{phone.type
}.PNG">
     <%
      PhoneNumber.PhoneType[] types = PhoneNumber.PhoneType.values();
      for( int i = 0; i < types.length; i++ ) {
     %>
     <tc:menuItem id="<%=types[i].toString()%>"
image='<%="image/phone_types/"+ types[i].toString() +".PNG"%>'
actionListener="#{personCtrl.updatePhoneType}" >
      <tc:attribute name="phoneType" value="<%=types[i].toString()%>"/>
      <tc:attribute name="renderedPartially"
value=":page:personForm:details:phoneListSubview:phones"/>
     </tc:menuItem>
     <%
     }
     %>
    </tc:menu>
   </tc:menuBar>

any idea?



2007/6/21, Zied Hamdi <[EMAIL PROTECTED]>:

Hello Again,

I have a little problem detecting what menu item was selected for a given
action, I saw that you know the info because of the request parameter's
value:

2007-06-21 14:28:18,921 [http-8080-Processor23] TRACE
org.apache.myfaces.tobago.util.DebugPhaseListener.beforePhase(97) - Param
: "page::form-action" =
"page:personForm:details:phoneListSubview:phones:1:WORK"
where WORK is one of the menu items:
[EMAIL PROTECTED] MenuBar phoneTypeMenuBar
page:personForm:details:phoneListSubview:phones:phoneTypeMenuBar
  [EMAIL PROTECTED] null phoneTypeMenu
page:personForm:details:phoneListSubview:phones:phoneTypeMenu
    [EMAIL PROTECTED] MenuCommand
HOME page:personForm:details:phoneListSubview:phones:HOME
    [EMAIL PROTECTED] MenuCommand
MOBILE page:personForm:details:phoneListSubview:phones:MOBILE
    [EMAIL PROTECTED] MenuCommand
WORK page:personForm:details:phoneListSubview:phones:WORK
    [EMAIL PROTECTED] MenuCommand
FAX page:personForm:details:phoneListSubview:phones:FAX
    [EMAIL PROTECTED] MenuCommand
OTHER1 page:personForm:details:phoneListSubview:phones:OTHER1
I expected there's way similar to the one we know from which line is a
<tc:link> in a <tc:sheet>, but I can't find the info...

 public String updatePhoneType() {
  UIData data = findComponent( UIData.class,
"page:personForm:details:phoneListSubview:phones" );
  PhoneNumber number = (PhoneNumber) data.getRowData();
  UIMenu menu = findComponent( UIMenu.class,
"page:personForm:details:phoneListSubview:phones:phoneTypeMenu" );
  String type = menu.*get???();*
  number.setType( PhoneType.valueOf( type ) );
  return null;
 }

In my page I have (sorry for the scripltlets, but seen that JSTL doesn't
work... *:..-(  *):

  <tc:sheet id="phones" columns="18px;*;18px;18px"
   value="#{personCtrl.current.bean.phones}" var="phone">
   <tc:column sortable="true">
    <tc:menuBar id="phoneTypeMenuBar">
     <tc:menu id="phoneTypeMenu" image="image/phone_types/#{phone.type
}.PNG">
      <%
       PhoneNumber.PhoneType[] types = PhoneNumber.PhoneType.values();
       for( int i = 0; i < types.length; i++ ) {
      %>
      <tc:menuItem id="<%=types[i].toString()%>"
image='<%="image/phone_types/"+ types[i].toString() +".PNG"%>' action="#{
personCtrl.updatePhoneType }" >
       <tc:attribute name="phoneType" value="<%=types[i].toString()%>"/>
      </tc:menuItem>
      <%
      }
      %>
     </tc:menu>
    </tc:menuBar>

   </tc:column>



2007/6/21, Zied Hamdi <[EMAIL PROTECTED]>:
>
>  Hello Arvid,
>
> Thanks for the info, I'm trying to use a menu to have the icon, there's
> more work to do (server side value change) but it's even nicer to look at
> ;-)
>
> I'll post how I did to share the info.
>
> Regards,
> Zied
>
> 2007/6/21, Arvid Hülsebus <[EMAIL PROTECTED]>:
> >
> > Hello!
> >
> > I think that images for select items which are implemented by OPTION
> > elements are currently not supported. For Firefox we could fix this by
> >
> > styling the OPTION element via a background image. But I didn't found
> > a
> > way to achieve this for IE.
> >
> > Regards,
> > Arvid
> >
> > Zied Hamdi wrote:
> > >
> > > Hi,
> > >
> > > I have a problem with combining JSTL with tobago:
> > >
> > > I'm in a sheet of phone numbers and I want to show the current phone
> > > type: mobile, home,.. as a combo box (with images).
> > >
> > > I took a look at the examples in the demo and I didn't find how to
> > > specify an image for every entry when using <tc:selectItems. So I
> > > decided to try using JSTL and the select box shows as it should but:
> > >
> > > The problems are three:
> > >
> > >     * A side effect adding other columns has appeared (view image:
> > >       columns are replicated twice with the exception of the select
> > box)
> > >     * The selected value is not displayed
> > >     * No image is displayed (this is maybe not a bug: there are no
> > >       images with these names. I deduced this because theresn't the
> > >       image for 'no image')
> > >
> > >
> > >   <tc:sheet id="phones" columns="50px;15*;18px;18px"
> > >    value="#{personCtrl.current.bean.phones}" var="phone">
> > >    <tc:column sortable="true">
> > >     <tc:selectOneChoice value="#{phone.type}">
> > >      <c:forEach items="${personCtrl.phoneTypes}" var="type">
> > >       <tc:selectItem itemImage="#{type}"
> > >        itemLabel="${type}" itemValue="#{type}" value="#{type}"/>
> > >      </c:forEach>
> > >     </tc:selectOneChoice>
> > >    </tc:column>
> > >    <tc:column label="#{i18n.number}" sortable="true">
> > >     <tc:in id="number" value="#{ phone.number}" />
> > >    </tc:column>
> > >    <tc:column label="#{i18n.main}" sortable="true">
> > >     <f:verbatim>hi</f:verbatim>
> > >    </tc:column>
> > >    <tc:column>
> > >     <tc:link id="removePhone" image="image/delete.GIF" />
> > >    </tc:column>
> > >   </tc:sheet>
> > >
> > > in the output source there's no images but these are maybe added
> > with
> > > javascript after...
> > >
> > > <div
> > >
> > id="page:personForm:details:phoneListSubview:phones_data_row_1_column0"
> > > class="tobago-sheet-cell-outer" style="width:84px; "
> > > ><div class="tobago-sheet-cell-inner"
> > > ><select
> > > name="page:personForm:details:phoneListSubview:phones:1:_idJsp24"
> > > id="page:personForm:details:phoneListSubview:phones:1:_idJsp24"
> > > style="width:80px; " class="tobago-selectOneChoice-default"
> > > ><option value=""
> > > >HOME</option><option value=""
> > > >MOBILE</option><option value=""
> > > >WORK</option><option value=""
> > > >FAX</option><option value=""
> > > >OTHER1</option><option value=""
> > > >OTHER2</option></select></div></div>
> > > Regards,
> > > Zied
> > >
> > >
> > >
> > ------------------------------------------------------------------------
> > >
> >
>
>
>
> --
> Zied Hamdi
> zatreex.sourceforge.net
>



--
Zied Hamdi
zatreex.sourceforge.net




--
Zied Hamdi
zatreex.sourceforge.net

Reply via email to