[ANSWERED] How to add fancybox in Grocery Crud
Posted 23 April 2012 - 12:07 PM
I'm trying to add fancybox in grocery crud.
My concept is , when I click the "add" or "edit" button on flexigrid, then opens a fancybox(jquery).
Like---[attachment=121:fancy_box.jpg].
Can you please help me.
Thanks again for the library.
Posted 23 April 2012 - 23:20 PM
Thanks and hope to get a reply to this soon!
Posted 23 April 2012 - 23:22 PM
[left]Thanks again![/left]
Posted 25 April 2012 - 16:28 PM
Quickly tested something and it worked hehe...
1. Ok edit "assets > grocery_crud > themes > flexigrid > list.php"
2. Add the following to the top: (change your url's as needed)
<link rel="stylesheet" href="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.pack.js?v=2.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
</script>
3. Add the callback to you controller function
$crud->callback_column('phone', array($this, '_callback_phone'));
4. Add the callback function
//FANCYBOX TEST
public function _callback_phone($value, $row)
{
return "<a href='http://www.grocerycrud.com/assets/themes/default/images/logo.png' class='fancybox'>$value</a>";
}
5. I added my fancybox files under "assets > plugins > fancybox" - you can put yours wherever you want to I guess
[attachment=124:capture.PNG]
Voila! Should all work
Posted 25 April 2012 - 16:40 PM
1. You callback
$crud->callback_column('customerName', array($this, '_callback_name'));
2. Your functions
function test_content()
{
echo 'BLARRRRP!!';
}
public function _callback_name($value, $row)
{
$atts = array(
'width' => '500',
'height' => '500',
'scrollbars' => 'yes',
'status' => 'yes',
'resizable' => 'yes',
'screenx' => '0',
'screeny' => '0'
);
return anchor_popup('examples/test_content', $value, $atts);
}
VOILA!!!!
Posted 25 April 2012 - 16:48 PM
[color=#282828][font=helvetica, arial, sans-serif]1. Ok edit "assets > grocery_crud > themes > flexigrid > list_template.php"[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]2. Add the following to the top: (change your url's as needed)[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]
[/font][/color]
<link rel="stylesheet" href="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.pack.js?v=2.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".various").fancybox();
});
</script>
[color=#282828][font=helvetica, arial, sans-serif]3. Around line 45 - change the class from class="add-anchor" to class="various fancybox.ajax"[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]
[/font][/color]
<a href='<?php echo $add_url?>' title='<?php echo $this->l('list_add'); ?> <?php echo $subject?>' class='various fancybox.ajax'>
[color=#282828][font=helvetica, arial, sans-serif]4. I added my fancybox files under "assets > plugins > fancybox" - you can put yours wherever you want to I guess[/font][/color]
[attachment=126:test.PNG]
I did all the above examples very quickly, but you can go further and customise various things im sure.... Coolios!!!!
Posted 25 April 2012 - 18:15 PM
I officially changed your status from advance member to "grocery CRUD magician"
Posted 25 April 2012 - 18:22 PM
Posted 25 April 2012 - 23:57 PM
Posted 26 April 2012 - 09:07 AM
Here i faces some problem.
Here the validation message shows the back of the fancybox that means the list page.
Another problem.This is my code
//home.php
<div id="container">
<?php $this->load->view("header"); ?>
<div id="wrapper">
<?php $this->load->view($view); ?>
</div>
<?php $this->load->view("footer"); ?>
</div>
//output.php ($view variable contain the file name output.php)
<div style="width:950px; margin:0 auto;min-height:450px;">
<?php echo $output ; ?>
</div>
When click the add button in the list page, the whole file(home.php) is open in thae fancybox. but i need only the output.php file is open.
Thanx again the magician.
Posted 26 April 2012 - 10:42 AM
change the class from
class='various fancybox.ajax'
to
class='various' data-fancybox-type="iframe"
Think that will work. Sorry im new to Fancybox so dont know all their code stuffs.
For the second problem maybe try this
Add #wrapper to the end of the href
href='<?php echo $add_url?>#wrapper'
and leave the class only as
class='various'
Nothing else and dont think it will work with iframe mode (I think)
Posted 03 May 2012 - 15:05 PM
<link rel="stylesheet" href="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.css?v=2.0.6" type="text/css" media="screen" />
<script type="text/javascript" src="<?=base_url()?>assets/plugins/fancybox/jquery.fancybox.pack.js?v=2.0.6"></script>
<script type="text/javascript">
$(document).ready(function() {
$(".fancybox").fancybox();
});
$(document).ready(function() {
$(".various").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none'
});
});
</script>
$crud->add_action('More', '', 'demo/action_more','ui-icon-plus varius fancybox.iframe ');
The fourth parameter ($css_class) not working properly?
[quote]
[list]
void add_action( string $label, string $image_url , string $link_url , string $css_class , mixed $url_callback)
[*][color=#0000FF]$css_class: [/color]add a CSS class. Remember that at the theme of datatables a CSS class includes images , for example : ui-icon-image, ui-icon-plus, e.t.c.
[/list]
[/quote]
Thanks a lot,
D.
Posted 08 May 2012 - 18:38 PM
$crud->add_action('More', '', 'demo/action_more','ui-icon-plus various');
and not "varius fancybox.iframe". Follow the instructions of [member='KaBaDaBrA'] and it will work for the action too.
Posted 12 May 2012 - 06:43 AM
$crud->add_action('More', '', 'demo/action_more','ui-icon-plus various');and not "varius fancybox.iframe". Follow the instructions of [member='KaBaDaBrA'] and it will work for the action too. [/quote]
There is a problem because the button add_action not function!
Posted 12 May 2012 - 08:18 AM
Posted 17 July 2012 - 08:04 AM
Posted 18 July 2012 - 05:58 AM
Posted 18 July 2012 - 06:13 AM
And what characters appear in the url? Is everything work well when you add those characters to ./application/config/config.php file at the line?
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
Posted 17 September 2012 - 13:41 PM
just go to codeigniter root and run patch -p0 < fancybox.patch
web-johnny, how about including fancybox classes as default in the code?
Then the only thing people need to do is to download fancybox to their installation.
Posted 28 March 2013 - 13:35 PM
Hi guys
I've tried to implement it but it's not working with the new crud...or is there anyone who can send a working demo of the fancybox add.
Thanks