Confusion with placeholder tags
Hello all, I am trying to implement a panel with a table whose tr's are Fragments. I am using ListView in order to generate several table rows, but my rendered table has some markup that I wish to eliminate: 1.- the tag, which I thought would be eliminated when calling .setOutputMarkupPlaceholderTag(false) 2.- the tag. I do not understand why this tag appears outside the tag. I have tried setOutputMarkupPlaceholderTag in the ListView, but it doesn't work either. Clearly, there is something about placeholder tags that I do not understand at all. Could anyone please help me with this? Any other suggestion on how to implement this table is welcome. Thanks a lot. Here is my panel code/markup and the rendered panel : ** Source Code: MyPanel.html: http://www.w3.org/1999/xhtml"; xmlns:wicket=" http://wicket.sourceforge.net/";> menu goes here caption MyPanel.java: public class MyPanel extends Panel { public MyPanel(String id, IModel model) { super(id,model); changeableComponent = contentPanel; Arrays.asList(new String[] { "item 1", "item 2" }) ListView lview = new ListView("menuitemrv", model) { //private int counter = 0; @Override protected void populateItem(ListItem listitem) { final String menuitemstr = (String) listitem.getModelObject(); listitem.add(new MenuItemFragment("menuitem","menuitemfragment", new Model(menuitemstr))); } }; lview.setOutputMarkupPlaceholderTag(false); add(lview); } class MenuItemFragment extends Fragment { public MenuItemFragment(String id, String markupId, IModel model) { super(id, markupId, MainMenuPanel.this, model); AjaxFallbackLink link = new AjaxFallbackLink("link") { @Override public void onClick(AjaxRequestTarget target) { } }; link.add(new Label("caption",model).setOutputMarkupPlaceholderTag(false)); add(link); } } } ** Rendered panel: item 1 http://www.google.com";> item 2
Re: Confusion with placeholder tags
setOutputMarkupPlaceholderTag is for ajax refreshes. See setRenderBodyOnly() or use in your markup. Martijn On Fri, Dec 26, 2008 at 4:02 PM, David Ojeda wrote: > Hello all, > > I am trying to implement a panel with a table whose tr's are Fragments. I am > using > ListView in order to generate several table rows, but my rendered > table has some markup that I wish to eliminate: > > 1.- the tag, which I thought would be > eliminated when calling .setOutputMarkupPlaceholderTag(false) > 2.- the tag. I do not understand why > this tag appears outside the tag. I have tried > setOutputMarkupPlaceholderTag in the ListView, but it doesn't work > either. > > Clearly, there is something about placeholder tags that I do not > understand at all. Could anyone please help me with this? > > Any other suggestion on how to implement this table is welcome. > > Thanks a lot. > > > > Here is my panel code/markup and the rendered panel > : > ** Source Code: > MyPanel.html: > > http://www.w3.org/1999/xhtml"; xmlns:wicket=" > http://wicket.sourceforge.net/";> > > > > > > > > > > menu goes here > > > > > > > > > >style="height: 26px; width =157px; vertical-align: middle; > padding-left: 25px; text-align: left; background: > url('images/menu-inicial.gif'); background-repeat: no-repeat;" >onmouseover="this.style.color='#c32127'" >class="tbmenuitem"> > > onmouseout="this.style.color=''" > onmouseover="this.style.color='#c32127'" > class="tbmenuitem" > href="#"> > caption > > > > > > MyPanel.java: > public class MyPanel extends Panel { > > >public MyPanel(String id, IModel model) { >super(id,model); >changeableComponent = contentPanel; > >Arrays.asList(new String[] { >"item 1", "item 2" }) >ListView lview = new ListView("menuitemrv", model) { > >//private int counter = 0; > >@Override >protected void populateItem(ListItem listitem) { >final String menuitemstr = (String) > listitem.getModelObject(); >listitem.add(new > MenuItemFragment("menuitem","menuitemfragment", new Model(menuitemstr))); > >} >}; > >lview.setOutputMarkupPlaceholderTag(false); >add(lview); > >} > >class MenuItemFragment extends Fragment { > > >public MenuItemFragment(String id, String markupId, IModel model) { >super(id, markupId, MainMenuPanel.this, model); > >AjaxFallbackLink link = new AjaxFallbackLink("link") { >@Override >public void onClick(AjaxRequestTarget target) { >} >}; > >link.add(new > Label("caption",model).setOutputMarkupPlaceholderTag(false)); > >add(link); >} > >} > > } > > > ** Rendered panel: > > > > > > > > > > > > > > style="background: transparent url(images/menu-inicial.gif) no-repeat scroll > 0% 0%; height: 26px; vertical-align: middle; padding-left: 25px; text-align: > left; -moz-background-clip: -moz-initial; -moz-background-origin: > -moz-initial; -moz-background-inline-policy: -moz-initial;" > onmouseout="this.style.color=''"> > > onmouseout="this.style.color=''" onclick="var > wcall=wicketAjaxGet('?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::IBehaviorListener:0:',null,null, > function() {return Wicket.$('link1') != null;}.bind(this));return !wcall;" > class="tbmenuitem" wicket:id="link" > href="?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::ILinkListener::"> > > item 1 > > > > > > > > > style="background: transparent url(images/menu-inicial.gif) no-repeat scroll > 0% 0%; height: 26px; vertical-align: middle; padding-left: 25px; text-align: > left; -moz-background-clip: -moz-initial; -moz-background-origin: > -moz-initial; -moz-background-inline-policy: -moz-initial;" > onmouseout="this.style.color=''"> > > onmouseout="this.style.color=''" onclick="var w = window.open(href, '', > 'scrollbars=yes,location=yes,menuBar=yes,resizable=yes,status=yes,toolbar=yes'); > if(w.blur) w.focus(); return false;" class="tbmenuitem" wicket:id="link" > href="http://www.google.co
Re: Confusion with placeholder tags
Thanks Martijn, I had a mixup between those methods. On Sat, Dec 27, 2008 at 10:45 AM, Martijn Dashorst < martijn.dasho...@gmail.com> wrote: > setOutputMarkupPlaceholderTag is for ajax refreshes. See > setRenderBodyOnly() or use in your markup. > > Martijn > > On Fri, Dec 26, 2008 at 4:02 PM, David Ojeda > wrote: > > Hello all, > > > > I am trying to implement a panel with a table whose tr's are Fragments. I > am > > using > > ListView in order to generate several table rows, but my rendered > > table has some markup that I wish to eliminate: > > > > 1.- the tag, which I thought would be > > eliminated when calling .setOutputMarkupPlaceholderTag(false) > > 2.- the tag. I do not understand why > > this tag appears outside the tag. I have tried > > setOutputMarkupPlaceholderTag in the ListView, but it doesn't work > > either. > > > > Clearly, there is something about placeholder tags that I do not > > understand at all. Could anyone please help me with this? > > > > Any other suggestion on how to implement this table is welcome. > > > > Thanks a lot. > > > > > > > > Here is my panel code/markup and the rendered panel > > : > > ** Source Code: > > MyPanel.html: > > > > http://www.w3.org/1999/xhtml"; xmlns:wicket=" > > http://wicket.sourceforge.net/";> > > > > > > > > > > > > > > > > > > > > menu goes here > > > > > > > > > > > > > > > > > > > > >style="height: 26px; width =157px; vertical-align: middle; > > padding-left: 25px; text-align: left; background: > > url('images/menu-inicial.gif'); background-repeat: no-repeat;" > >onmouseover="this.style.color='#c32127'" > >class="tbmenuitem"> > > > > > onmouseout="this.style.color=''" > > onmouseover="this.style.color='#c32127'" > > class="tbmenuitem" > > href="#"> > > caption > > > > > > > > > > > > MyPanel.java: > > public class MyPanel extends Panel { > > > > > >public MyPanel(String id, IModel model) { > >super(id,model); > >changeableComponent = contentPanel; > > > >Arrays.asList(new String[] { > >"item 1", "item 2" }) > >ListView lview = new ListView("menuitemrv", model) { > > > >//private int counter = 0; > > > >@Override > >protected void populateItem(ListItem listitem) { > >final String menuitemstr = (String) > > listitem.getModelObject(); > >listitem.add(new > > MenuItemFragment("menuitem","menuitemfragment", new Model(menuitemstr))); > > > >} > >}; > > > >lview.setOutputMarkupPlaceholderTag(false); > >add(lview); > > > >} > > > >class MenuItemFragment extends Fragment { > > > > > >public MenuItemFragment(String id, String markupId, IModel model) > { > >super(id, markupId, MainMenuPanel.this, model); > > > >AjaxFallbackLink link = new AjaxFallbackLink("link") { > >@Override > >public void onClick(AjaxRequestTarget target) { > >} > >}; > > > >link.add(new > > Label("caption",model).setOutputMarkupPlaceholderTag(false)); > > > >add(link); > >} > > > >} > > > > } > > > > > > ** Rendered panel: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > style="background: transparent url(images/menu-inicial.gif) no-repeat > scroll > > 0% 0%; height: 26px; vertical-align: middle; padding-left: 25px; > text-align: > > left; -moz-background-clip: -moz-initial; -moz-background-origin: > > -moz-initial; -moz-background-inline-policy: -moz-initial;" > > onmouseout="this.style.color=''"> > > > > > onmouseout="this.style.color=''" onclick="var > > > wcall=wicketAjaxGet('?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::IBehaviorListener:0:',null,null, > > function() {return Wicket.$('link1') != null;}.bind(this));return > !wcall;" > > class="tbmenuitem" wicket:id="link" > > > href="?wicket:interface=:1:aswborder:mainmenu:menuitemrv:0:menuitem:link::ILinkListener::"> > > > > item 1 > > > > > > > > > > > > > > > > > > > style="background: transparent url(images/menu-inicial.gif) no-repeat > scroll > > 0% 0%; height: 26px; vertica