You can now clone a row by simply calling “enable_copyrow()” function. Once it’s enabled, select a row and then in “Copy Row” button in the footer. It will duplicate the selected row in the database table and even return the auto-incremented ID. Note that this feature requires the primary key is an auto-increment type.
1 2 3 4 | $dg = new C_DataGrid("SELECT `orderNumber`, `orderDate`, `requiredDate`, `shippedDate`, `status`, `comments`, `customerNumber` FROM `orders`", "`orderNumber`", "orders"); $dg -> enable_edit("FORM", "CRUD"); $dg -> enable_copyrow(true); $dg -> display(); |