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 94 entries

# Product name Product price Product sell price Tax Product discount Actions
1 1968 Dodge Charger 76 117 1 0.00
2 1940 Ford Pickup Truck 59 116 0 0.00
3 1993 Mazda RX-7 84 141 0 0.00
4 1937 Lincoln Berline 61 102 0 0.00
5 1936 Mercedes-Benz 500K Special Roadster 25 53 0 0.00
6 1965 Aston Martin DB5 66 124 0 0.00
7 1980s Black Hawk Helicopter 78 157 0 0.00
8 1917 Grand Touring Sedan 87 170 0 0.00
9 1948 Porsche 356-A Roadster 54 77 0 0.00
10 1995 Honda Civic 94 142 0 0.00
# Product name Product price Product sell price Tax Product discount Actions