⚠ 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

Relation problem



xmyownprisonx
  • profile picture
  • Member

Posted 09 September 2014 - 10:49 AM

how to show the corresponding value of my requisitioner table on view not the id

my requisitioner table having ( id, requisitioner )

  ex: 1 -> Finance Dept

        2 ->Accounting Dept

 

 

 

--->at my purchreq.php(using "transaction table")

$crud->set_relation('requisitioner','requisitioner','requisitioner'); --my dropdown is working and it shows on the view

 

 

 

---->at my purchaseorder.php( using "purchaseorder table")

     

$crud->callback_field('requisitioner',array($this,'_requisitioner'));

 

$crud-> where('prs_no',$primary_key);  // primary_key has the id from the transaction table
 
$data = $this->db->get_where('transaction',array('prs_no'=>$primary_key))->row_array();
      

        function _requisitioner()
            {
           
            $result = $this->db->get_where('transaction',array('prs_no'=>$this->prs_no));
                        return '<input type="hidden" name="requisitioner" value="'.$this->prs_no.'">';
           
            }

 

 

 

--->at my reports.php

$crud->set_table('purchaseorder');

$crud->columns('prs_no','requisitioner');

 

$crud->set_relation('requisitioner','transaction','requisitioner'); -- at my report the requisitioner only shows the "id" not the value.

 

 

any help? thank you so much.....

 

 

   

 

 


Amit Shah
  • profile picture
  • Member

Posted 09 September 2014 - 14:26 PM

well i will better recomend u use the following

/topic/1561-simple-dependant-dropdown-extension/

 

That should solve your trouble a lot