Add New Column dynamically on CRUD Table New Column addition dynamically on CRUD Table

You can add new table column dynamically based on two columns value for example you want to show order total based on order sub total and tax. You can also merge two columns to generate a new column for example you can merge first name and last name to generate new column "Full Name". By default, new column is added at the last. Since it is dynamic column, so it doesn't support search/sort function.

  
                                 $pdocrud = new PDOCrud();
                                    //Add new column total which is calculated as sum of two columns (you can pass any no. of columns)
                                    $pdocrud->tableColAddition("Total", "sum",array("product_sell_price","tax"));
                                    //Add new colum Sell/price which is calculated as division of two columns
                                    $pdocrud->tableColAddition("Sell/price", "divide",array("product_sell_price","product_price"));
                                    //Merge column to generate a new column ( you can pass any no. of columns)
                                    $pdocrud->tableColAddition("Product Info", "merge",array("product_id","product_name"));
                                    
                                    $pdocrud->crudTableCol(array("product_name","product_id", "product_price","product_sell_price","tax","product_discount"));
                                    $pdocrud->crudRemoveCol(array("product_name","product_id"));
                                    echo $pdocrud->dbTable("products")->render();
                            

Add new table column

Products

Showing 1 to 10 of 109 entries

# Product price Product sell price Tax Product discount Total Sell/price Product Info Actions
1 48.81 95.70 23 5 118.7 S10_1678 1969 Harley Davidson Ultimate Chopper
2 50.00 214.30 0 0 214.3 S10_1949 1952 Alpine Renault 1300
3 68.99 118.94 0 0 118.94 S10_2016 1996 Moto Guzzi 1100i
4 91.02 193.66 0 0 193.66 S10_4698 2003 Harley-Davidson Eagle Drag Bike
5 85.68 136.00 0 0 136 S10_4757 1972 Alfa Romeo GTA
6 103.42 147.74 0 0 147.74 S10_4962 1962 LanciaA Delta 16V
7 95.34 194.57 0 0 194.57 S12_1099 1968 Ford Mustang
8 95.59 207.80 0 0 207.8 S12_1108 2001 Ferrari Enzo
9 77.90 136.67 0 0 136.67 S12_1666 1958 Setra Bus
10 66.27 150.62 0 0 150.62 S12_2823 2002 Suzuki XREO
# Product price Product sell price Tax Product discount Total Sell/price Product Info Actions