No, it really makes more sense to have it on the dataScroller. dataTables can (and most of the time do) have multiple datascrollers. I always have two datascrollers on each dataTable.
I do think it'd be great if you could specify the target by something other than the id. However, I don't think overloading "for" to mean different things is a good idea. (It's not a bad idea to be able to specify the id using a value binding, but the value binding should still return an id). I notice the new Focus component uses a "component" attribute for specifying an EL binding to the target component. Maybe that's a good pattern to follow. I'm also using "for" on my compareToValidator, but maybe I should support component as well. On 11/28/05, Yee CN <[EMAIL PROTECTED]> wrote: > Maybe add an attribute in t:dataTable for it to look for the dataScroller? > It is more logical that way. > > <t:dataTable id="..." dataScroller="myDataScroller" ... /> > > Yee > > -----Original Message----- > From: Simon Kitching [mailto:[EMAIL PROTECTED] > Sent: Monday, 28 November 2005 9:41 AM > To: MyFaces Discussion > Subject: Connecting dataTable and dataScroller > > Hi, > > The t:dataScroller component has a "for" attribute that must be set to > the id of the t:dataTable it is associated with. > > As the dataScroller tag is quite verbose, I would like to put it in a > separate file and reference it from multiple pages like: > > <t:dataTable id="..." ..../> > > <t:aliasBean alias="#{target}" value="#{demoPagingBean}"> > <jsp:include page="/jsp/pages/demo/dataScroller.jsp"/> > </t:aliasBean> > > This works find, except that the "for" attribute in the dataScroller > *must* match the id of the table, and my table ids change depending upon > what the page is. In fact, on some pages I have multiple tables, and > want a dataScroller attached to each one. > > Does anyone have a nice solution for this? > > If not, then what do people think of: > > * altering t:dataScroller so that when "for" is null, it tries to look > for the nearest preceding sibling of type HtmlDataTable and connect to that. > > * allowing the "for" attribute to be an EL-expression referencing an > HtmlDataTable component: > > <t:dataTable id="..." binding="#{myBean.dataTable}" ../> > <t:dataScroller for="#{myBean.dataTable}" .../> > > * other suggestions?? > > > Thanks, > > Simon > >

