I need a simple upload field for image. Nothing complicated, so "set_upload_field_example".
On Add/Edit page FancyBox works perfectly, but on main grid when I click thumbnail, default action is opening new browser tab (target="_blank").
I've searched forum, but there is no 'trivial' solution or at least without changing core files.
So please let me know, if there is better way than this:
Controller file:
$this->grocery_crud->set_css('assets/grocery_crud/css/jquery_plugins/fancybox/jquery.fancybox.css');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery-1.8.1.min.js');
$this->grocery_crud->set_js('assets/grocery_crud/js/jquery_plugins/jquery.fancybox.pack.js');
$this->grocery_crud->set_js('../js/jquery.fancybox_grocery.js');
....
$this->grocery_crud->callback_column('image', array($this, '_callback_image_popup'));
....
public function _callback_image_popup($value, $row)
{
return '<a href="../../../upload/products/normal/'.$value.'" class="image-thumbnail">'.$value.'</a>';
}
jquery.fancybox_grocery.js
$(document).ready(function() {
$(".image-thumbnail").live("click",function(ev){
$this = $(this);
ev.preventDefault();
$.fancybox({
'href': $this.attr('href'),
'type': 'image',
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'speedIn' : 600,
'speedOut' : 200,
'overlayShow' : true
})
});
});