0
votes

I've implemented JQuery tablesorter from http://tablesorter.com/docs/.

The sorting part works fine but I'm having trouble getting the background images into the table headers.

HTML table code:

echo '<table id="viewAll" class="tablesorter">';
            echo '<thead>';
            echo '<tr>';
            echo '<th>Product</th>';
            echo '<th>PBI</th>';
                echo '<th>Status</th>';
            echo '<th>Summary</th>';
            echo '<th>Record Created</th>';
            echo '<th>Record Updated</th>';

            echo '</tr>';
            echo '</thead>';

The CSS code for getting the background image:

table.tablesorter thead tr  .header {
    background-image: url(images/tablesorter/bg.gif);
    background-repeat: no-repeat;
    background-position: left top;
    cursor: pointer;
}

As I said the sorting works fine, I can get the cursor pointer but just can't seem to get the background image on.

What am i missing..?

3

3 Answers

2
votes

I get the feeling the css selector is bad. Depending on what you want to put background to, the <thead> or each <th> this may do the trick http://jsfiddle.net/MVCmx/1/. Also, check that the image url is actually referencing to something on your app, the image path may be bad.

table.tablesorter > thead {
  background-image: url('yourimagepath')
}​
1
votes

Check your image path correctly , a relative path should start like as below and give background url instead of background-image

background:url("../images/header-bg.gif");
0
votes

are you using apache on windows 7? i had similar problem. tried a lot of things and what i found was that i coudln't even access the image directly from the URL. it said "forbidden"

my problem's that the bg.gif, as.gif, and desc.gif images in the theme folder are all encrypted. (you can tell by their green file names in Vista or 7)

Just have to unencrypt it by clicking the file->property->advance and uncheck the encrypt box. and that should do the trick.