Jump to content


Member Since 08 Sep 2012
Offline Last Active Sep 12 2012 09:58 AM

Topics I've Started

How do I disable Sorting for certain Columns of CRUD grid?

11 September 2012 - 12:14 PM

Does anyone know how I can disable some certain columns from the CRUD?


How do I create a custom field in Grid bottom, to show a Total Amount of XYZ amounts in...

11 September 2012 - 12:10 PM

I have a grid that shows values something like:

Date of Transaction, Title of Transaction, Deposit Amount, Withdraw Amount

As you can see, it's a table of Transactions that either get Withdrawn or Deposited to some account.

I want to be able to do show a TOTAL Balance field in the Grid in the last row perhaps, and sum up the amounts and show the Total there. Not sure how to add that Row and column, any ideas?


How to add custom field in edit/add view that doesn't exist in database?

11 September 2012 - 11:11 AM

I have a table of Transactions with columns like:

I want to show the add/edit form the following fields:
type (deposit or withdraw)

I want the user to select whether the type of this transaction he's adding is of deposit or withdraw, and then before insertion I want the system to figure out what user has selected, and then set the field value (either deposit or withdraw) to what he has chosen, from the field of amount.

But the problem is, I can't add a custom field to the add/edit form that doesn't exist in database, because if I do, the insertion of CRUD simply fails.

Here's some code snippet, can anyone help?
// Set title or subject of this CRUD
   // Set database table name for CRUD operations
   // Set Relation of tables for CRUD operations
   $crud->set_relation('category_id','category', 'title');
   // Columns for Grid
   $crud->columns('date','title','category_id', 'deposit', 'withdraw', 'balance');
   // Order by
   // Load custom Transactions_model
   // Callbacks for columns on grid
   // Display field as
   // Fields for add/edit form
   // Hide some fields from add/edit form from user
   // $crud->change_field_type('deposit','invisible');
   // $crud->change_field_type('withdraw','invisible');
   // Required fields
   // Callback on field on add/edit form
   // Render Crud
   $output = $crud->render();
   // Load view