tags:

views:

217

answers:

1

Hi All

Can anyone please tell me how to add table background image in wicket. Actually I've tried a lot like

<table background="images/logo.jpg">

also

<style>table {background-image: url('images/logo.jpg')}</style>

also

<table style="background-image: url('images/logo.jpg')">

But nothing works.

Please help. Thanks in advance.

+1  A: 

Perhaps you've got something wrong when you add your wicket markup to it?

Wicket shouldn't do anything with styling your markup unless you use an AttributeAppender or something similar. What I would do is separate things into CSS, HTML, and Java files:

.logo {
  background-image: url(images/logo.jpg);
}
.logo td, .logo tr {  /* Optional - make sure that table background is seen */
  background-image: none;
}

<table wicket:id="myTable" class="logo">...</table>

Alternatively, you could add the logo it in wicket:

WebMarkupContainer myTable = new WebMarkupContainer("myTable");
myTable.add(new AttributeAppender("class", true, 
        new Model<String>("logo"), " "));

You may also be running into some basic CSS problem, and without more of your HTML markup, it is hard to really help you. But have a look at this question for some ideas.

Personally, I would just wrap the table in a DIV and put the background image in the DIV.

Tauren