"Customizing the placement of sorting icons in displaytag: A step-by-step guide

I am trying to align sorting icons to the extreme right of the columns in displaytag by using "sortable=true". How can I achieve this? Below is an example with one column for reference:

<display:column  property="issuerName" scope="col" sortable="true" title="${issuerName}"  headerClass="hixTableHeader" class="displayTagtd" /> 

Below is the CSS code snippet for achieving this alignment:

th.sortable a {
    background-image: url(../images/common/header/arrow_off.png);
    background-repeat: no-repeat;
    background-position:right;
    text-decoration: none;
    padding-right:25px;
    padding-left: 25px;

}

th.order1 a{
    background-image: url(../images/common/header/arrow_down.png);
    background-position:right;
    background-repeat: no-repeat;
    text-decoration: none;
    padding-right:25px;
    padding-left: 25px;
}

th.order2 a{
    background-image: url(../images/common/header/arrow_up.png);
    background-repeat: no-repeat;
    text-decoration: none;
    background-position:right;
    padding-right:25px;
    padding-left: 25px;
}

Answer №1

Consider placing it on <th> instead of <a>. Since <a> is an inline element, it may not fully stretch the size of the <th>.

th.sortable {
    background-image: url(../images/common/header/arrow_off.png);
    background-repeat: no-repeat;
    background-position:right;
}

th.order1 {
    background-image: url(../images/common/header/arrow_down.png);
    background-position:right;
    background-repeat: no-repeat;
}

th.order2 {
    background-image: url(../images/common/header/arrow_up.png);
    background-repeat: no-repeat;
    background-position:right;
}

Another option would be to implement the following code, which will cause the <a> to fill the entire <th>, allowing users to click anywhere within the <th> for sorting.

th a {
    display:block;
    width:100%;
    height:100%;
}

Update

Ensure you maintain your current styles to retain underlines by targeting your <a> tags. You can add this code to target all <a> tags within <th> tags.

th a {
    text-underline:none;
}

Answer №2

To modify the display of <display:column>, you may need to edit the template file where the HTML code is located.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Regular expression locating the word 'Java' regardless of case

I'm having trouble figuring out the correct regex in Java to search for specific words in a list. Artichoke, armadillo, Barbecue String keyWord = ar; List<String> l = myList.stream().filter(word -> word.matches("(?i)("+keyWord+")").collect( ...

Could Chrome be miscalculating em unit values in media queries?

I have defined my media query breakpoints as shown below: @media screen and (max-width:48em){ /* phone */ } @media screen and (min-width:48.063em){ /* tablet */ } After using a PX to EM calculator to get the 48.063em value (as I was advised to us ...

The system is not identifying the constructor

Upon running the program, I encountered an issue with the constructors. The error message stated that The constructor Package() is undefined and The constructor InsuredPackage() is undefined. Strangely, the classes Package and InsuredPackage seemed to be ...

Tips for using the SQL IN Operator to efficiently retrieve all values from a query

Currently, I am working on a Java code dedicated to showing all data from a certain database table. The query responsible for fetching the table-data is stored in the jar file. This particular table has the following structure: Column1 Column2 City D ...

Overriding Bootstrap navigation styles

Having trouble overriding the default styling of my bootstrap navigation bar. I've tried using the !important tag in my CSS, but it's not working as expected. Any help would be greatly appreciated! HTML: <nav class="navbar navbar-expand- ...

Refreshing an ImageView asynchronously in JavaFX

Greetings, everyone! I am working on a program that needs to automatically control machinery and display the temporary state of the workshop using javaFX. The processes are executed sequentially, and for each one, I need to update an image (or label) on th ...

Is it feasible for Selenium WebDriver to function without requiring a System.setProperty() method to specify the driver path

In my work with Java and Selenium WebDriver, I have been considering the possibility of replacing code like: System.setProperty("webdriver.gecko.driver", dirPath + "\\src\\test\\resources\\geckodriver.exe"); with a ...

How can I address the issue of the snackbar overlapping the view instead of shifting it upwards?

I am working with a Coordinator Layout setup that looks like this: <android.support.design.widget.CoordinatorLayout android:id="@+id/coordinator_subreddit_selection" android:layout_width="match_parent" android:layout_height="mat ...

How do I make a div's height equal to 100% of the height of its parent

I am trying to make a button stick to the bottom of a card no matter how much content is on it. I used the Bootstrap class mt-auto, which worked well. However, when I set the height of all divs to 100%, the row in the card body overflows from the lg breakp ...

Guidelines for aligning an image beside text using CSS

I am looking to position an image on the left side of some text and have it adjust based on window resolution. Without the image, this is how it appears: http://prntscr.com/fmky4f This is the desired appearance after adding the image: My code snippet: ...

The Safari browser displays the mobile-friendly version of the website

Everything appears correctly when looking at the website in Firefox and Chrome. However, Safari is displaying the mobile version of the site instead. I did not make any CSS changes specifically for desktop screens while working on the responsive design for ...

Is there a method to adjust the styling of my <header> once the page hits a specific #anchor point?

Seeking some assistance with a website design challenge I am facing. I am currently working on a one-page portfolio site with four #anchor points that serve as "pages". Each div has a height of 100% to fill the entire browser height. The header, which co ...

Is the element visible before the specified wait time? If so, will the implicit/explicit wait still wait until the specified time or click?

In a scenario where I have set an implicit wait of 30 seconds for an element to click, but the script actually finds the element in only 10 seconds, what will happen? Will it still wait the full 30 seconds or click the element immediately? The same quest ...

Adjusting the opacity overlay color in CSS

Is it possible in CSS to specify a different color for the overlap of two opaque elements? For instance, can I make two yellow elements that overlap turn orange at their intersection point? ...

Selenium is having trouble reading the text from a dropdown that has the autocomplete feature disabled

It seems that Selenium is having trouble retrieving the text from the dropdown options. Here is a snippet of the code I am working on: WebElement dropdown=driver.findElement(By.id("selFromAccount")); List<WebElement> dropoptions=dropdown.findElemen ...

Modify the design of the button in the CSS code

I am facing an issue with the layout of the Visible Columns button and unable to standardize it like the buttons above using CSS enter image description here The code snippet for the Visible Columns button is as follows: import React, { useState, useEffe ...

Unveiling the Quirk of Foundation 5: Grid Encounters a Popping

Recently, I encountered an issue with Foundation 5. Whenever I attempt to apply the "position:fixed" property on a "div" element that is part of the Foundation Grid, it causes the div to break out of the grid and align itself with the left edge of the ro ...

How to Exclude Specific JARS from Scanning in Embedded Tomcat with Servlet 3.0

Discover a simple technique for embedding a Tomcat server that automatically identifies Servlet 3.0 initializers: public static void main(String[] args) throws ServletException, LifecycleException { Tomcat tomcat = new Tomcat(); tomcat.setPort(808 ...

Is SonarQube 5.6 compatible with executing Decorators in plugins created using version 4.5.2 of the sonar-plugin-api?

After setting up Sonarqube 5.6 and downloading the C# plugin, I decided to enhance the plugin by obtaining the code of the installed version (5.3.2). The C# plugin project is linked to sonar-plugin-api version 4.5.2 To add new metrics that need to be cal ...

Bootstrap 4 tables with responsive design do not utilize the full 100% width

While creating a web app using Bootstrap 4, I encountered some strange problems. In particular, I wanted to make use of Bootstrap's table-responsive class for allowing horizontal scrolling of tables on mobile devices. However, on desktop devices, the ...