Hello and welcome to the forums [member=clone kihiato].
Let me see if I get this right,
During add/edit you want at the table tblstudent the fields identification and countryid to be present.
So we do this by using the fields function.
But we don't want to display these two fields while listing the records, so by using the columns function.
By doing this we eliminate two fields but we still need to display, while in listing (grid operation) the identification[country.code].
We can do this by doing the undocumented feature of a fake column explaind here.
Using the fake column (via the callback_column) you can generate this $row->identification . "[" . $row->countryid . "]";
But the problem with this is that you get the code but not the actual value (name) of the country.
If we assume that you have a set_relation about the countryid so the users during add/edit select the country name you can use an unofficial hack to display this.
1. Make sure at the top of your controller function you put this line: $this->output->enable_profiler(TRUE); This will enable the profiling display that CodeIgniter supplies
2. Look for the DATABASE Queries and press SHOW
3. Look for the SELECT query in order to find the relation you built and look for the AS part
4. Use the AS part as the name within your callback_column e.g. $row->s3f168119
Check this example,
http://eletter.gr/samples/gc_ic/index.php/gc_examples/customers_management
and the code is
function customers_management()
{
$this->output->enable_profiler(TRUE);
$crud = new grocery_CRUD();
$crud->set_table('customers');
$crud->columns('customerName','contactLastName','phone','city','country','salesRepEmployeeNumber','creditLimit', 'time_col', 'fake_column');
$crud->fields('customerName','contactLastName','phone','city','country','salesRepEmployeeNumber','creditLimit', 'true_col', 'time_col');
$crud->display_as('salesRepEmployeeNumber','from Employee')
->display_as('customerName','Name')
->display_as('contactLastName','Last Name')
->display_as('time_col', 'Time Column test');
$crud->set_subject('Customer');
$crud->set_relation('salesRepEmployeeNumber','employees','lastName');
$crud->set_relation('true_col','film','{title} {release_year}');
$crud->callback_column('fake_column',array($this,'_cb_fake_column'));
$output = $crud->render();
$this->_gc_output($output);
}
public function _cb_fake_column($value, $row)
{
return $row->country . "[" . $row->s3f168119 . "]";
}
I hope this makes sense.