one more on that.

The rows="10" ensures that you only see 10 items on a page. IF you have more,
paging is done for you, without any other scroller or so. :)

-M

On 1/12/07, Matthias Wessendorf <[EMAIL PROTECTED]> wrote:
Trent,

have you ever checked Trinidad's <tr:table> ?
It is pretty much straight forward to do a selection there:

      <tr:table summary="Bundeslaender"
        value="#{lov.data}" var="row" rows="10"
        rowSelection="single"
        binding="#{lov.table}">
        <tr:column>
          <f:facet name="header">
            <tr:outputText value="Name"/>
          </f:facet>
          <tr:outputText value="#{row.name}"/>
        </tr:column>
      </tr:table>
      <tr:panelButtonBar>
        <tr:commandButton text="Cancel" immediate="true"
            action="#{lov.cancel}"/>
        <tr:commandButton text="Select"
            action="#{lov.select}"/>
      </tr:panelButtonBar>


in the select you do:

  public String select()
  {
    FacesContext context = FacesContext.getCurrentInstance();

    Iterator<Object> iterator = _table.getSelectedRowKeys().iterator();
    String rowKey = (String) iterator.next();
    Object oldRowKey = _table.getRowKey();
    _table.setRowKey(rowKey);
    ValueBinding binding = context.getApplication().
      createValueBinding("#{row.name}");
    Object value = binding.getValue(context);
    RequestContext.getCurrentInstance().returnFromDialog(value, null);
    _table.setRowKey(oldRowKey);

    return null;
  }



note you can also set the "rowSelection" to multiple.
See [1] for more.

-Matthias


[1] http://incubator.apache.org/adffaces/trinidad-api/tagdoc/tr_table.html

On 1/12/07, Trent Rosenbaum <[EMAIL PROTECTED]> wrote:
> Thanks for getting back to me.  I was thinking that I would have to do
> this, but was hoping that I could find another way.  At least I am not
> alone with this.
>
> Trent
>
> On 12/01/07, Jeff Bischoff <[EMAIL PROTECTED]> wrote:
> > Trent,
> >
> > What I do is wrap the domain object in a web-tier object. The web-tier
> > object has two properties: the domain object and a "selected" boolean
> > property. Then I have a column in my dataTable like so:
> >
> > <h:column>
> >     <f:facet name="header"><h:outputText value="Selected"/></f:facet>
> >     <t:selectBooleanCheckbox value="#{data.selected}"/>
> > </h:column>
> >
> > When I need to do processing, I grab the list of web-tier objects and
> > check to see which ones are selected.
> >
> > Regards,
> >
> > Jeff Bischoff
> > Kenneth L Kurz & Associates, Inc.
> >
> > Trent Rosenbaum wrote:
> > > Hi there,
> > >
> > > When interacting with the DataTable component I have to define a
> > > boolean field on the domain object that represents a row in the table
> > > to allow multiple checkbox selection.  Is this to right way to proceed
> > > with this development?
> > >
> > > I could for example have a domain object called 'Student' that has
> > > been delivered to me by others in an organisation.  I do no control
> > > the development of this object, but to interact with it through a
> > > multiple select table I have to define a UI only used field on the
> > > above object.  If on the other hand I settled for single radio button
> > > selects on the table then I could use the getter methods on the UI
> > > component to identify which object the user is interacting with.
> > >
> > > I am new to JSF but to me this seems like a cross over of layers.  To
> > > me the domain object should not have to define this field.  I was
> > > looking at the example under the trinidad/ADF project and there seems
> > > to be a table component that would allow me to gain a list of the rows
> > > that were checked.
> > >
> > > Is there anything I have over looked within the core myfaces API
> > > project and/or tomahawk projects?  How do other navigate through this
> > > issue?  Do people end up creating wrappers for the data and then
> > > display them within the DataTable instance?
> > >
> > > Many thanks
> > > Trent
> > >
> > >
> > >
> >
> >
> >
>


--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com



--
Matthias Wessendorf
http://tinyurl.com/fmywh

further stuff:
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Reply via email to