Class Td<T extends Td<T>>


public class Td<T extends Td<T>> extends TableCell<T>
Represents the HTML <td> element for defining a table data cell.

The Td class provides a Java representation of the HTML table data cell element, which contains the actual data content within a table row. Data cells can contain text, numbers, HTML elements, or any other content, and support sorting functionality through custom sort data attributes.

Features:

  • Data content containment for table rows
  • Support for text, numbers, and HTML element content
  • Custom sort data for client-side table sorting
  • Type-safe sort data methods for numeric types
  • Inherits cell styling and spanning capabilities from TableCell

Usage Example:


 // Create basic data cells
 Td nameCell = new Td();
 nameCell.addText("John Doe");

 // Create a cell with sort data
 Td priceCell = new Td();
 priceCell.addText("$19.99");
 priceCell.setSortData(19.99);

 // Create a cell with integer sort data
 Td quantityCell = new Td();
 quantityCell.addText("5 items");
 quantityCell.setSortData(5);

 // Create a cell with date sort data
 Td dateCell = new Td();
 dateCell.addText("Jan 15, 2024");
 dateCell.setSortData("2024-01-15"); // ISO format for sorting

 // Add to a table row
 Tr row = new Tr();
 row.addCell(nameCell);
 row.addCell(priceCell);
 row.addCell(quantityCell);
 
Since:
2007
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Td

      public Td()
      Creates a new Td table data cell.
  • Method Details

    • setSortData

      public void setSortData(short data)
      Sets the sort data for this cell using a short value.
      Parameters:
      data - The short value to use for sorting.
    • setSortData

      public void setSortData(int data)
      Sets the sort data for this cell using an int value.
      Parameters:
      data - The int value to use for sorting.
    • setSortData

      public void setSortData(long data)
      Sets the sort data for this cell using a long value.
      Parameters:
      data - The long value to use for sorting.
    • setSortData

      public void setSortData(float data)
      Sets the sort data for this cell using a float value.
      Parameters:
      data - The float value to use for sorting.
    • setSortData

      public void setSortData(double data)
      Sets the sort data for this cell using a double value.
      Parameters:
      data - The double value to use for sorting.
    • setSortData

      public void setSortData(String data)
      Sets the sort data for this cell using a string value. The sort data is stored as a data-sortdata attribute for client-side sorting.
      Parameters:
      data - The string value to use for sorting.