Print output doesn't match with view in html
- Single Page
Posted 06 July 2013 - 18:38 PM
I already searched in this forum and still didn't get the answer. Anybody have idea?
Posted 07 July 2013 - 00:50 AM
td:nth-child(2) div
{
text-align:right!important;
}
That one will make the second column to be right-aligned
Posted 07 July 2013 - 06:41 AM
Posted 07 July 2013 - 06:49 AM
How to make the print preview use our custom css?
Posted 07 July 2013 - 12:20 PM
Unfortunately there is no way to modify print page without extending or editing groceryCRUD library itself.
The quick and dirty way is to find _print_webpage function in /application/libraries/grocery_CRUD.php
The function contains this:
protected function _print_webpage($data)
{
$string_to_print = "<meta charset=\"utf-8\" /><style type=\"text/css\" >
#print-table{ color: #000; background: #fff; font-family: Verdana,Tahoma,Helvetica,sans-serif; font-size: 13px;}
#print-table table tr td, #print-table table tr th{ border: 1px solid black; border-bottom: none; border-right: none; padding: 4px 8px 4px 4px}
#print-table table{ border-bottom: 1px solid black; border-right: 1px solid black}
#print-table table tr th{text-align: left;background: #ddd}
#print-table table tr:nth-child(odd){background: #eee}
</style>";
$string_to_print .= "<div id='print-table'>";
$string_to_print .= '<table width="100%" cellpadding="0" cellspacing="0" ><tr>';
foreach($data->columns as $column){
$string_to_print .= "<th>".$column->display_as."</th>";
}
$string_to_print .= "</tr>";
foreach($data->list as $num_row => $row){
$string_to_print .= "<tr>";
foreach($data->columns as $column){
$string_to_print .= "<td>".$this->_trim_print_string($row->{$column->field_name})."</td>";
}
$string_to_print .= "</tr>";
}
$string_to_print .= "</table></div>";
echo $string_to_print;
die();
}
Add your css there.
WARNING: that gonna applied globally
