post by wesambeshir on Sep 11, 2021

Hi ,
i want create custom columns to display a custome text depend on the value
for ex.. the column for user active , and this table filed conaine integer value 1 or 0 , so when the value is 1 it will show text (Activated) in the column value ..
how i can do it ?

post by mariel_alberto on Sep 11, 2021

post by larasmith on Sep 14, 2021

Hi @wesambeshir!

For this you can either use field types or set relation whichever is convenient for you. Take note that in set relation, it would require you to create another table wherein your data would relate to.

For fieldtypes using GroceryCRUD Community Edition you can do this:
(It is assumed here that your field name was “useractive”)

$crud->field_type('useractive','dropdown',
            array('0' => 'Inactive', '1' => 'Active'));

For fieldtypes using GroceryCRUD Enterprise Edition you can do this:
(It is assumed here that your field name was “useractive”)

$crud->fieldType('useractive', 'dropdown_search', [
    '0' => 'Inactive',
    '1' => 'Active'
]);

For set relation using GroceryCRUD Community Edition you can do this:
(It is assumed here that you have a table called tblboolean and it has a field called bool_Name which contains records: Inactive and Active)

$crud->set_relation('useractive_id','tblboolean','bool_Name');

For set relation using GroceryCRUD Enterprise Edition you can do this:
(It is assumed here that you have a table called tblboolean and it has a field called bool_Name which contains records: Inactive and Active)

$crud->setRelation('useractive_id','tblboolean','bool_Name')

I hope this helps you out :blush:

29 days later

post by aanhaservices on Oct 14, 2021

Select Add column>custom column.the custom column dialog box appears.enter a new column name. insert a column into the custom column formula box by selecting a column from the available columns list, and then selecting insert.

1 / 4
Sep 2021