⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

adding extra column from other table without callback



MD Rahat Islam Khan
  • profile picture
  • Member

Posted 17 March 2014 - 10:26 AM

i have a table named 'product'.it has following fields "code","name","unit","specification"..on the other hand i have a table called 'order'

it has the following field "code","price". when i submit an order it just stores the product code and the unit price.

 

my code 

$crud->set_table('order')

i want to add extra 3 column to show the price and specification,name along with the product code.so my column will be

'code','name','unit','specification','price'

i am trying to avoid callback because in callback search,and ascending/descending doesn't work.

 

thanks in advance


Amit Shah
  • profile picture
  • Member

Posted 17 March 2014 - 17:36 PM

hi there,

 

there is a weired but a solution that might just work - give it a shot and see if it works or not

set relation to the product code with products table and there

where u want to display - just display all 3 fields in format you want...

 

that should do it i believe


MD Rahat Islam Khan
  • profile picture
  • Member

Posted 18 March 2014 - 10:33 AM

if i am not wrong are you suggesting to do like this

$crud->set_relation('code','product','name');

but it will show the name instead of product code.i want both code,name,unit and price from the product table


Amit Shah
  • profile picture
  • Member

Posted 18 March 2014 - 12:28 PM

well.. u could add up more thn 1 field

$crud->set_relation('code','product','{name} [{unit}] - ({specification})');

something like this if u use - go ahead with - u will find this option much worth it


MD Rahat Islam Khan
  • profile picture
  • Member

Posted 22 March 2014 - 16:38 PM

it tried this but its not what i am looking for.i want every field value in every column."name","unit","price" will be in three column.and is there any way to rename it like

"name"=>product name and "unit"=>product unit

 

thanks in advance Amit


victor
  • profile picture
  • Member

Posted 23 March 2014 - 22:48 PM

use own model. There is the way to use that