⚠ 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

[partially solved] link cells



Raboo
  • profile picture
  • Member

Posted 31 May 2012 - 14:48 PM

Hi,

I've attached a image of my table to try to explain better what I want to do.

This table consists of several JOINs.
For instance Service Windows is on the service_window table and contains description on how to order the service window, who to contact.. etc. etc..
What I want is when I press on "First Monday" under service Window, a popup/fancybox or redirected to a page displaying the other columns of the service_window table..
When I press on the customer name, I want to be redirected to the customer table..

Is that even possible?
If not, then I want to add button that displays the service window details.

Thanks,
Raboo

Raboo
  • profile picture
  • Member

Posted 31 May 2012 - 16:51 PM

So far I've been able to to do this:

function _callback_servicewindow($value, $row)
{
return "<a href='".site_url('main/service_window/edit/'.$row->id)."'>$value</a>"; // This is line 52
}
function unique_field_name($field_name)
{
return 's'.substr(md5($field_name),0,8); //This s is because is better for a string to begin with a letter and not with a number
}



$crud->callback_column($this->unique_field_name('service_window_idservice_window'),array($this,'_callback_servicewindow'));
$crud->set_relation('service_window_idservice_window','service_window','name');


But I get this error:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$id
Filename: controllers/main.php
Line Number: 52

Raboo
  • profile picture
  • Member

Posted 04 June 2012 - 18:22 PM

After a lot of headache i finally understood how the $row works. I guess this have to do with the fact that I don't know php or any other programming languages.
But solution is

{
return "<a href='service_window/edit/$row->service_window_idservice_window'>$value</a>";
}