Subject: Re: Display Tag Library
From: "Matt Raible" <[EMAIL PROTECTED]>
 ===
You can do this with a decorator.  I created my own ListWrapper.java
decorator class:

<snip>
public class ListWrapper extends TableDecorator {
 /**
  * Creates a new Wrapper decorator who's job is to reformat some of the
  * data located in our forms.
  */

 public ListWrapper() {
  super();
 }

 /**
  *  Returns an xhtml-compliant checkbox used to select multiple rows
  */
 public String getAssetBox() {
  AssetForm form = (AssetForm) this.getObject();
  String assetId = form.getAssetId();

  return "<input type=\"checkbox\" name=\"rowId\" value=\""
   + assetId
   + "\" />";
 }
}
</snip>

In my assetList.jsp:
<bean:struts id="searchURL" forward="searchAsset"/>


<html:form action="/assetEdit" styleId="assetForm">
<display:table name="assetResults" scope="request"
    requestURI="<%=request.getContextPath() + searchURL.getPath()%>"
    pagesize='<%=(String)session.getAttribute("pageSize")%>'
    decorator="com.raibledesigns.webapp.taglib.ListWrapper">
    <display:column property="assetBox" width="3%"
        title="<input type=\"checkbox\" name=\"allbox\"
onclick=\"checkAll(document.forms[0])\">"/>
   ... continue rest of columns

And the checkAll javascript function:

function checkAll(theForm) { // check all the checkboxes in the list
  for (var i=0;i<theForm.elements.length;i++) {
    var e = theForm.elements[i];
  var eName = e.name;
     if (eName != 'allbox' &&
            (e.type.indexOf("checkbox") == 0)) {
         e.checked = theForm.allbox.checked;
  }
 }
}

HTH,

Matt

<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
>
> You mentioned that you had a bunch of features.... You dont happen to
> have one that works with the multicheckbox control?  I want to add a
> delete checkbox to each row...
>
>
>
>
>
>
> -----Original Message-----
> From: lists [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, July 04, 2002 12:29 AM
> To: struts-user
> Subject: RE: Wow - Continued...
>
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > -------------------------------------------
> > The Display Tag library  ( http://edhill.its.uiowa.edu/display/ )
> > This was the best one I could find for it, although the documentation
> is
> > somewhat lacking and required some source diving to learn that I could
> > do grouping and such.  It supports Dynabeans and does all kinds of
> nice
> > looking things...  I could go into it all now, but if you go to the
> web
> > site its all already described.
>
> Ed had a BOF at JavaOne this year to sort of show how he came up with
> that
> tag lib and how it works. It's very straightforward, easy to use, and
> easy
> to modify. I've already added a bunch of features that I'm going to
> submit
> back to him, and they all were extremely easy to implement. If anybody
> has a
> table tag they are in love with that seems like it's better than this,
> I'd
> love to hear about it!
>
> Joe
>
>
> --
> To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
>
>
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to