I don't have time right now to look at your example but you mentioned
that the behavior you wanted was working fine in the master detail
example.  If that is the case it would seem to be a problem on your
end.  (I'm not saying there is not a bug, just interpreting your
findings.)

Please keep us posted.  Feel free to dig into the source code and
debug it that way.  You may end up discovering a legit bug and help us
with the patch.

sean

On 5/31/05, Kris Verhoye <[EMAIL PROTECTED]> wrote:
> Hi Mark!
> 
> Thanks for replying!
> 
> I just tried it: I'm using the action method that implements the
> navigation I put behind the commandLink to read the param. If I print
> out the object id of the object that should reside in the x:dataTable
> var variable (in my case 'publication'), it just prints nothing (which
> is weird, I would've expected the id).
> It does seem that the event is handled for every single row, so if I
> print out the param (or try to), it will just do it for every row... In
> my opinion nothing will work as long as the table can't distinguish its
> rows by id. Or am I wrong about this?
> Another strange thing is; if I narrow my table down to the standard tags
> of h:dataTable, the latter does render ids!
> 
> I thought about using params, but I was just trying to get the table to
> generate those ids as that would simply seem more normal to me. If it
> would generate those, it would be much easier to get the selected
> values. I want to add a checkbox per row next. Those checkboxes will not
> get their ids either...
> 
> Is this normal behaviour or is it something that's simply not working?
> 
> Thanks again for the help!
> 
> Greetings,
> Kris
> 
> -----Original Message-----
> From: mfaine [mailto:[EMAIL PROTECTED]
> Sent: 31 May 2005 19:03
> To: myfaces-user@incubator.apache.org
> Subject: Re: x:dataTable doesn't render an id per row?
> 
> 
> 
> On Tue, 31 May 2005 15:35:05 +0200, "Kris Verhoye"
> <[EMAIL PROTECTED]> wrote :
> 
> > This is a multi-part message in MIME format.
> >
> >
> > Hi!
> >
> > I know that there have been a lot of questions regarding the
> > dataTable, but I still can't get mine to work.
> >
> > I have a table which looks like this:
> >
> >             <x:dataTable id="pubTable"
> >                          styleClass="publicationTable"
> >                          headerClass="publicationTable_SortHeader"
> >
> > rowClasses="publicationTable_row1,publicationTable_row2"
> >                          var="publication"
> >                          value="#{publicationsBean.publicationModel}"
> >                          sortColumn="#{publicationsBean.sort}"
> >                          sortAscending="#{publicationsBean.ascending}"
> >                          preserveDataModel="true"
> >                          preserveSort="true">
> >               <h:column>
> >                 <f:facet name="header">
> >                   <h:panelGroup></h:panelGroup>
> >                 </f:facet>
> >                 <h:graphicImage
> > alt="#{pubmgr_messages['alt_validated']}"
> >                                 url="#{publicationsBean.validated ==
> > 'true' ? pubmgr_messages['img_greenlight'] :
> > pubmgr_messages['img_redlight']}">
> >                 </h:graphicImage>
> >               </h:column>
> >               <h:column>
> >                 <f:facet name="header">
> >                   <x:commandSortHeader columnName="code" arrow="true">
> >                     <h:outputText value="Code" />
> >                   </x:commandSortHeader>
> >                 </f:facet>
> >                 <x:commandLink
> > action="#{publicationsBean.goToPublicationDetail}" immediate="true"
> > styleClass="publication_select">
> >                   <x:outputText value="#{publication.code}" />
> >                 </x:commandLink>
> >               </h:column>
> >               <h:column>
> >                 <f:facet name="header">
> >                   <x:commandSortHeader columnName="name" arrow="true">
> >                     <h:outputText value="Name" />
> >                   </x:commandSortHeader>
> >                 </f:facet>
> >                 <h:outputText value="#{publication.names['en']}" />
> >               </h:column>
> >             </x:dataTable>
> >
> > The table is rendered to this:
> >
> > <table id="pubForm:pubTable" class="publicationTable"> <thead>
> >
> > <tr><th class="publicationTable_SortHeader"></th><th
> > class="publicationTable_SortHeader"><a href="#"
> > onclick="clear_pubForm();document.forms['pubForm'].elements['autoScrol
> > l'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id11';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;" id="pubForm:pubTable:_id11">Code</a></th><th
> > class="publicationTable_SortHeader"><a href="#"
> >
> onclick="clear_pubForm();document.forms['pubForm'].elements['autoScroll'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id16';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;"
> > id="pubForm:pubTable:_id16">Name&#x2193;</a></th></tr></thead>
> > <tbody>
> > <tr class="publicationTable_row1"><td><img id="pubForm:pubTable:_id9"
> > src="/pubmgr/images/redlight.gif" alt="validate status"/></td><td><a
> > href="#"
> >
> onclick="clear_pubForm();document.forms['pubForm'].elements['autoScroll'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id13';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;" id="pubForm:pubTable:_id13"
> > class="publication_select">testcode1</a></td><td>testname1</td></tr>
> > <tr class="publicationTable_row2"><td><img id="pubForm:pubTable:_id9"
> > src="/pubmgr/images/redlight.gif" alt="validate status"/></td><td><a
> > href="#"
> >
> onclick="clear_pubForm();document.forms['pubForm'].elements['autoScroll'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id13';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;" id="pubForm:pubTable:_id13"
> > class="publication_select">testcode2</a></td><td>testname2</td></tr>
> > <tr class="publicationTable_row1"><td><img id="pubForm:pubTable:_id9"
> > src="/pubmgr/images/redlight.gif" alt="validate status"/></td><td><a
> > href="#"
> >
> onclick="clear_pubForm();document.forms['pubForm'].elements['autoScroll'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id13';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;" id="pubForm:pubTable:_id13"
> > class="publication_select">testcode3</a></td><td>testname3</td></tr>
> > <tr class="publicationTable_row2"><td><img id="pubForm:pubTable:_id9"
> > src="/pubmgr/images/redlight.gif" alt="validate status"/></td><td><a
> > href="#"
> >
> onclick="clear_pubForm();document.forms['pubForm'].elements['autoScroll'
> >
> ].value=getScrolling();document.forms['pubForm'].elements['pubForm:_link
> >
> _hidden_'].value='pubForm:pubTable:_id13';if(document.forms['pubForm'].o
> >
> nsubmit){document.forms['pubForm'].onsubmit();}document.forms['pubForm']
> > .submit();return false;" id="pubForm:pubTable:_id13"
> >
> class="publication_select">testcode4</a></td><td>testname4</td></tr><tbo
> > dy></table>
> >
> > The publicationsBean backing bean has the following setters/getters:
> >
> >   public DataModel getPublicationModel()
> >   {
> >     if (this.publicationModel == null)
> >     {
> >       this.publicationModel = new ListDataModel();
> >     }
> >     if (this.sortablePublications == null)
> >     {
> >       this.sortablePublications = new
> > SortablePublicationList(loadPublications());
> >     }
> >
> > this.publicationModel.setWrappedData(this.sortablePublications.getPubl
> > ic
> > ations()); <--- so I just put a list of Publications in the DataModel
> >     this.publicationModel.addDataModelListener(new DataModelListener()
> >     {
> >    public void rowSelected(DataModelEvent e)
> >    {
> >     System.out.println("row selected:" + e.getRowIndex()); <-----
> > clicking on a link in the table activates this for the whole column?!
> >    }
> >     });
> >     return this.publicationModel;
> >   }
> >
> >   public void setPublicationModel(DataModel dataModel)
> >   {
> >     this.publicationModel = dataModel;
> >   }
> >
> >   private List loadPublications()
> >   {
> >     <return a List of Publication>
> >   }
> >
> >   public String getSort()
> >   {
> >     if (this.sortablePublications == null)
> >     {
> >       this.sortablePublications = new
> > SortablePublicationList(loadPublications());
> >     }
> >     return this.sortablePublications.getSort();
> >   }
> >
> >   public void setSort(String sort)
> >   {
> >     this.sortablePublications.setSort(sort);
> >   }
> >
> >   public boolean isAscending()
> >   {
> >     if (this.sortablePublications == null)
> >     {
> >       this.sortablePublications = new
> > SortablePublicationList(loadPublications());
> >     }
> >     return this.sortablePublications.isAscending();
> >   }
> >
> >   public void setAscending(boolean ascending)
> >   {
> >     this.sortablePublications.setAscending(ascending);
> >   }
> >
> > The sorting works, as it is I'm already quite happy with the output
> > ;-)
> >
> > Yet! I can't get the id of selected Publication once the commandLink
> > is pressed as there seems to be a problem with the generated ids of
> > each row!
> >
> > As far as I know, each id should be something like
> > pubForm:pubTable_0:_id13, pubForm:pubTable_1:_id13, etc...?!
> >
> > As all my rows have the same id (see the rendered table), the
> > DataModel's getDataRow() method always returns the last item from the
> > row (after having iterated over the whole column it seems).
> >
> > Does anyone know what my problem could be?
> >
> > The master/detail example from the myfaces examples does get an id per
> 
> > row so I'm reckoning it's still possible.
> >
> > I tried using <x:updateActionListener
> > property="#{publicationsBean.selectedPublication}"
> > value="#{publication}" />, but the problem remains as the system can't
> 
> > differentiate between the rows...
> >
> > Many thanks in advance for any help!!
> >
> > Greetings,
> > Kris
> >
> >
> 
> Hi Kris,
> 
> Have you tried passing a param with a unique identifier for the row and
> using an actionlistener to get the selected row?
> 
> -Mark
> 
>

Reply via email to