Formula based Formatting of CRUD table column Format crud table column using formula

You can format table column using various formula functions. For example you can make any table column content to uppercase, first letter uppercase, lowercase or you can add prefix, suffix etc.

  
                               $pdocrud = new PDOCrud();
                                // format field to 2 decimal point
                               $pdocrud->tableColFormatting("tax", "formula",array("type" =>"round","decimalpoint"=>2));
                               // format field to 2 decimal point
                               $pdocrud->tableColFormatting("product_discount", "formula",array("type" =>"number_format","decimalpoint"=>2));
                               // get ceil value of field
                               $pdocrud->tableColFormatting("product_price", "formula",array("type" =>"ceil"));
                               //get floor value of field
                               $pdocrud->tableColFormatting("product_sell_price", "formula",array("type" =>"floor"));

                               $pdocrud->crudTableCol(array("product_name", "product_price","product_sell_price","tax","product_discount"));
                               echo $pdocrud->dbTable("products")->render();
                            

Formula based table content formatting

Products

Showing 1 to 10 of 110 entries

# Product name Product price Product sell price Tax Product discount Actions
1 12312 2134.00 234 234 234.00
2 1969 Harley Davidson Ultimate Chopper 48.81 95 0 5.00
3 1952 Alpine Renault 1300 50.00 214 0 0.00
4 1996 Moto Guzzi 1100i 68.99 118 0 0.00
5 2003 Harley-Davidson Eagle Drag Bike 91.02 193 0 0.00
6 1972 Alfa Romeo GTA 85.68 136 0 0.00
7 1962 LanciaA Delta 16V 103.42 147 0 0.00
8 1968 Ford Mustang 95.34 194 0 0.00
9 2001 Ferrari Enzo 95.59 207 0 0.00
10 1958 Setra Bus 77.90 136 0 0.00
# Product name Product price Product sell price Tax Product discount Actions