⚠ 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

Display image from another table which has relation



kanted
  • profile picture
  • Member

Posted 23 November 2017 - 10:46 AM

I am trying to display a image in grocery crud edit page from another table. Have provided the relation it is just displaying the file name and not the image. Below is my code let me know where I need to correct. Also don't want to update the image in my edit table (inwardinventory). just need to display it based on selection of sacoskucode column from mastersku table.

public function entry()
{
$crud = new grocery_CRUD();

//$crud->set_theme('datatables');
$crud->unset_delete();

$crud->set_table('inwardinventory');
$crud->set_primary_key('SacoSku','inwardinventory');
$crud->set_relation('SacoSku','mastersku','SacoSku');
$crud->set_relation('PdtImage','mastersku','PdtImage');
$crud->set_field_upload('PdtImage','assets/uploads/files');
$crud->set_subject('In Out Stock');
$crud->field_type('TranscationType','dropdown',
array('IN' => 'Inward / Purchase','OUT' => 'Out Ward / Sale / Basement'));
$output = $crud->render();

$this->_example_output($output);
}

 


Amit Shah
  • profile picture
  • Member

Posted 23 November 2017 - 16:43 PM

Well my friend - GC is designed to work in the best possible way. What your requirement is way beyond normal expectations ;) 

The image in edit form will only be displayed for field makrked for uploading. For you to display it as image - you need to do a callback_edit where you will be able to render the code for displaying the image. This way, you need to take in control for displaying image in your own hands.

 

Happy GCing :)