Jump to content


adding extra column from other table without callback

column callback

  • Please log in to reply
5 replies to this topic

#1 MD Rahat Islam Khan

MD Rahat Islam Khan

    Member

  • Members
  • PipPip
  • 13 posts

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



#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 17 March 2014 - 05: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



#3 MD Rahat Islam Khan

MD Rahat Islam Khan

    Member

  • Members
  • PipPip
  • 13 posts

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



#4 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

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



#5 MD Rahat Islam Khan

MD Rahat Islam Khan

    Member

  • Members
  • PipPip
  • 13 posts

Posted 22 March 2014 - 04: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



#6 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 23 March 2014 - 10:48 PM

use own model. There is the way to use that







Also tagged with one or more of these keywords: column, callback

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users