RE: Re: Barracuda: dynamically setting the value of the class-attribute

Kirk Daries <[email protected]>
Newsgroups gmane.comp.java.enhydra.barracuda.general
Message-ID <[email protected]>
Hi,

Sometimes it IS neccesary to set the html tag 'attributes' manually based 
on some arbitary logic

You can use BComponent's 'setAttr(ibute)' method...

Eg.

    } else if (key.equals("p_budgettype")) {
      BInput bInput = new BInput();
      bInput.setType(bInput.TEXT);
      bInput.setName("p_budgettype");
      bInput.setAttr("class","TextBox");
      bInput.setAttr("id","M, Budget Type");
      bInput.setAttr("size","20");
      return bInput;

HTH
Regards
KD

Ps.
If all you want to do is have odd/even rowns, I'd use Jakob's trick which 
uses's css styles to set odd/even rows.
Scan the mail archive for it.



-----Original Message-----
From: Andras Balogh [mailto:[email protected]]
Sent: 03 March 2003 04:17
To: [email protected]
Subject: [Barracuda] Re: Barracuda: dynamically setting the value of the
class-attribute






----- Original Message -----
From: "Jan Marten Visser" <[email protected]>
To: <[email protected]>
Sent: Monday, March 03, 2003 16:05
Subject: Barracuda: dynamically setting the value of the class-attribute


> Hi,
>
> I got this HTML template:
>
> <html>
> ...
> <table>
>   <tr>
>     <td class="ThisIsMyProblem" id="Name">Some text</td>
>   </tr>
> </table>
> ...
> </html>
>
> I want to be able to change the class-attribute dynamically, when the
> row is even, I want the class attribute to be "even", when it is odd I
> want the attribute to be "odd". For clairity: I am using the class
> attribute as a reference to a stylesheet class, the id-attribute refers
> to the directives file.
>
> Ik know of course how to populate the tags between the <td>'s, but I
> don't know how to set the tag-attributes themselves dynamically.
>
> Any tips?
>


Hi,

I can't answer you question, but i would suggest using an Iterative Model to
build your
cells.
Something like this:
..
<td class="Dir::Iterate_Start.YourModel Dir::Iterate_Next.YourModel
oddstyle" >Some text</td>
<td class="Dir::Iterate_Next.YourModel evenstyle" >Some text</td>
<td class="Dir::Iterate_End.YourModel Dir::Discard" >[End]</td>

Like this you don't mix your stylesheet logic in your code.
You can check out the Examples too to see how the Iterative Models work.


_______________________________________________
Barracuda mailing list
[email protected]
http://barracudamvc.org/lists/listinfo/barracuda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.