Skip to content

How to add header to column alias, and how to hide it?

Sometimes you would have a column alias (in bold)

$sql = 'select
        concat(productName, " ", MSRP) as NamePrice,
        productCode,
        productName, MSRP
        fromproducts';

$dg = new C_DataGrid($sql, "productCode", "products");
$dg->display();

You can hide the first column with CSS

table th:nth-child(1),
table td:nth-child(1) {
  display: none;
}

Or you can choose to add a column name also with CSS 

table th:nth-child(1):after {
    content: 'My header'
}

No Javascript :)

Feedback and Knowledge Base