Cool, those both helped alot.  Unfortunately, they have lead me to
realize another major flaw in my plan.  Of course the wicket panel is
destroying the content in the template.  In most cases that is a
feature, but in this case the point is for the control to act as a
wrapper around other content (both static AND wicket replaced).  But
of course, the panel is replacing that content.

So is there a way to preserve the child content?  To illustrate the
plan, I want my markup in the HTMl template to look something like:

<div wicket:id='drawTabsHere'>
  <div id="tab1">Tab One! <input type=text wicket:id="myTag"></div>
  <div id="tab2">Tab Two!</div>
 </div>

but the rendered HTML would add a hidden input, and some javascript,
but would otherwise preserve the rest of it's content, including any
wicket:id marked tags.  It would go to the browser as something like:

<div id='drawTabsHere'>
  <input type=hidden name="activeTab" value="0">
  <div id="tab1">Tab One! <input type=text name="myTag" value="whatever"></div>
  <div id="tab2">Tab Two!</div>
 </div>
<script>/* some javascript not worth repeating here */</script>

I suppose I *might* be able to have the drawTabsHere div NOT
encapsulate the tab1 and tab2 div's.  That is the direction I will
start moving, but is there a way to achieve the above ideal?  Since
tab1 and 2 are children of the drawTabsHere node, it would be better
if the markup reflected that.

On 5/21/10, Richard Wilkinson <richardjohnwilkin...@googlemail.com> wrote:
> Hi,
>
> 1)
> To get wicket to output a dom id you must call
> mycomponent.setOutputMarkupId(true).  This will output a generated dom
> id, which you can access in your java code by calling
> mycomponent.getMarkupId().
> Wicket will overrwrite any dom id in your code, if that element is
> used for a wicket component (ie has wicket:id="myid")
>
> 2)
> Wicket tags like <wicket:panel> are removed if the application is
> running in deployment mode, but are rendered if the application is
> running in development.  You can control this explicitly by calling
> getMarkupSettings().setStripWicketTags(true); in your application init
> code, or by using
> Application.get().getMarkupSettings().setStripWicketTags(true); in any
> wicket code.
>
>
> --
> Regards - Richard Wilkinson
> Developer,
> jWeekend: OO & Java Technologies - Development and Training
> http://jWeekend.com
>
>
> On 21 May 2010 17:51, Brian Mulholland <blmulholl...@gmail.com> wrote:
>> Our app will be using ExtJS tab controls.  So to make that easier I
>> wrapped the ExtJS code up into a Wicket Panel to hide the complexity
>> of working with ExtJS.  The idea is that I would tell my class what
>> the wicket:id of the span/div was to draw the thing to, as well as
>> naming the N subtab id's (these are the HTML ids) so that the class
>> could write out the javascript code to render the tabs from the markup
>> already in the page.  So the HTML would look like:
>>
>> <div wicket:id='drawTabsHere'>
>>  <div id="tab1">Tab One!</div>
>>  <div id="tab2">Tab Two!</div>
>> </div>
>>
>> And the java code would look like:
>>
>> add(new MyTabPanel("drawTabsHere", "tab1", "tab2"));
>>
>> The premise is REALLY close to working.  Here's my problems:
>>
>> 1) The wicket:id="" attribute on the div won't copy the id into the
>> markup.  I must repeat it in the template <div
>> wicket:id='drawTabsHere' id='drawTabsHere'>.  I tried adding the id
>> via an Attribute Modifier like so:
>>
>> add(new AttributeModifier("id", new Model(renderToID)));
>>
>> But it ignores me.  I'd rather not force my developers to repeat the
>> id.  How can I accomplish that?
>>
>> 2) More importantly, the rendering of the tabs is malfunctioning.  I
>> believe that it is because the panel actually DRAWS the <wicket:panel>
>> tag around the subtab div's and thus screws up ExtJS.  I didn't
>> realize that panels wrote the wicket tags out to the browser until i
>> hit this.  I'd always assumed that "wicket:" tags were for the
>> server's use, and were not rendered.  How can I suppress this so that
>> the DOM hierarchy is right for my use?
>>
>> I do have a hidden input tag in the wicket:panel in order to preserve
>> the selected tab so that we preserve it between submits.  I tried
>> removing it and it did not help, but cannot remove the wicket:panel
>> without Wicket throwing an exception.
>>
>>
>> --
>> Brian Mulholland
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Brian Mulholland

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to