Yii Framework Forum: Fancybox Issues an Usage Discussion - Yii Framework Forum

Jump to content

  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Fancybox Issues an Usage Discussion Rate Topic: -----

#1 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 16 July 2010 - 12:16 PM

Just relesed the Fancybox extension.
0

#2 User is offline   nasrul 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 14-April 09
  • Location:Sorowako - Indonesia

Posted 20 July 2010 - 10:04 PM

View Postthiagovidal, on 16 July 2010 - 12:16 PM, said:

Just relesed the Fancybox extension.


would you please describe how to use it.

i add these on my view page, but nothing appear
<div style="display:none"><div id="data">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div></div>
<?php $this->widget('application.extensions.fancybox.CFancyBox', array(
	'target'=>'data',
	'config'=>array(
		'scrolling'		=> 'no',
		'titleShow'		=> false,
	),
	)
);
?>


what should 'target' refer to?
0

#3 User is offline   nasrul 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 98
  • Joined: 14-April 09
  • Location:Sorowako - Indonesia

Posted 21 July 2010 - 01:07 AM

solved

<?php echo CHtml::link("tes","#data", array('id'=>'inline')); ?>
<div style="display:none"><div id="data">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div></div>
<?php $this->widget('application.extensions.fancybox.CFancyBox', array(
	'target'=>'a#inline',
	'config'=>array(
		'scrolling'		=> 'yes',
		'titleShow'		=> true,
	),
	)
);
?>




0

#4 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 21 July 2010 - 07:42 AM

Yes you need a link to fancybox work.
1

#5 User is offline   chazclark 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 22-May 10

Posted 22 July 2010 - 05:58 PM

Thanks for making this extension. I'm having a problem where I can't configure any of the event keys for the extension (onStart, onCancel, etc). The problem occurs when I try and place a function within a value for the configuration. For example, in my configuration array I have:

'config' => array(
'onStart'=>"function(){console.log('it works'');}",
'onClosed'=>"function(){alert('it closes');}"
),

However, when Yii generates the script it comes out as:

{
'onStart':'function(){console.log(\'it works\'\');}',
'onClosed':'function(){alert(\'it works\');}'
});

It seems as if Yii is putting quote marks around the function. Is there anyway around this?
Thanks for your help.
0

#6 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 22 July 2010 - 06:34 PM

View Postchazclark, on 22 July 2010 - 05:58 PM, said:

Thanks for making this extension. I'm having a problem where I can't configure any of the event keys for the extension (onStart, onCancel, etc). The problem occurs when I try and place a function within a value for the configuration. For example, in my configuration array I have:

'config' => array(
'onStart'=>"function(){console.log('it works'');}",
'onClosed'=>"function(){alert('it closes');}"
),

However, when Yii generates the script it comes out as:

{
'onStart':'function(){console.log(\'it works\'\');}',
'onClosed':'function(){alert(\'it works\');}'
});

It seems as if Yii is putting quote marks around the function. Is there anyway around this?
Thanks for your help.


Yes dude. I got this issue on one of my projects...
Try use 'js:...' at the beginning of the functions like folow

'onStart':'js:function(){console.log(\'it works\'\');}',
'onClosed':'js:function(){alert(\'it works\');}'
1

#7 User is offline   chazclark 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 22-May 10

Posted 22 July 2010 - 08:19 PM

View Postthiagovidal, on 22 July 2010 - 06:34 PM, said:

Yes dude. I got this issue on one of my projects...
Try use 'js:...' at the beginning of the functions like folow

'onStart':'js:function(){console.log(\'it works\'\');}',
'onClosed':'js:function(){alert(\'it works\');}'

Thanks a lot. Your solution worked like a charm.
0

#8 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 23 July 2010 - 07:20 AM

View Postchazclark, on 22 July 2010 - 08:19 PM, said:

Thanks a lot. Your solution worked like a charm.


Thanks. I'm glad that this work properly.
0

#9 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 04 August 2010 - 05:48 AM

I want to close fancybox from other element. I wonder why the $.fancybox.close() doesn't take any effect? The error said "$.fancybox is undefined". Do you know why?
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#10 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 04 August 2010 - 08:30 AM

View Postjunxiong, on 04 August 2010 - 05:48 AM, said:

I want to close fancybox from other element. I wonder why the $.fancybox.close() doesn't take any effect? The error said "$.fancybox is undefined". Do you know why?


Could you post your code?
0

#11 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 04 August 2010 - 09:51 PM

View Postthiagovidal, on 04 August 2010 - 08:30 AM, said:

Could you post your code?


This is the view where I put the fancybox

<script type="text/javascript">
    <?php

/*
 * The javascript for calling ajax
 *
*/        
echo CHtml::ajax(array('update'=>'#dialog_ground', 'url'=>Yii::app()->createUrl('/Barang/cari',
                array('inputField'=>'MutasiBarangDet_barang_id'))));
    ?>
</script>


<div class="row">
            <?php echo $form->textField($model,'barang_id'); ?>
            <?php echo CHtml::link('Pilih Barang','#dialog_ground',array('id'=>'tampilbarang'));  ?>
            <div class="hidden"><div id="dialog_ground" ></div></div>
          
	</div>
        <?php $this->widget('application.extensions.fancybox.CFancyBox', array(
                'target'=>'a#tampilbarang',
                'config'=>array(
                        'scrolling'=> 'yes',

                ),
                )
        );?>


This is the ajax page that I called, it's view

<?php

      $dp = $model->search();
      $dp->keyAttribute='id';
      $this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'barang-grid',
        'dataProvider'=>$dp,
        'filter'=>$model,
        'columns'=>array(
                array(
                  'name'=>'id',
                  'value'=>'$data->id',
                ),
                'nama',
        ),
));?>

<div class="row button" align="right">
<?php
/* Klik Ok! and it will close the fancybox */
echo CHtml::ajaxButton('Ok!','',
        array('success'=>'js:function() {
            var p_sel = $.fn.yiiGridView.getSelection("barang-grid");
            if ( p_sel != "") {
                $("#'.$inputField.'").val(p_sel);
                $.fancybox.close(); //<--- I want to close at here. but it said "$.fancybox is undefined" 
            }
        }'),array('id'=>'selectButton'));
?>
</div>

“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#12 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 05 August 2010 - 12:21 AM

I've found the solution...

I need to put the widget to the ajax page become like this :
<?php $this->widget('application.extensions.fancybox.CFancyBox', array(
                'target'=>'a#tampilbarang',
                'config'=>array(
                        'scrolling'=> 'yes',

                ),
                )
        );?>

<?php
      $dp = $model->search();
      $dp->keyAttribute='id';
      $this->widget('zii.widgets.grid.CGridView', array(
        'id'=>'barang-grid',
        'dataProvider'=>$dp,
        'filter'=>$model,
        'columns'=>array(
                array(
                  'name'=>'id',
                  'value'=>'$data->id',
                ),
                'nama',
        ),
));?>

<div class="row button" align="right">
<?php
/* Klik Ok! and it will close the fancybox */
echo CHtml::ajaxButton('Ok!','',
        array('success'=>'js:function() {
            var p_sel = $.fn.yiiGridView.getSelection("barang-grid");
            if ( p_sel != "") {
                $("#'.$inputField.'").val(p_sel);
                $.fancybox.close(); 
            }
        }'),array('id'=>'selectButton'));
?>
</div>


By changing this, the fancybox is becomed recognized and it closed successfully
Thanks :)
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#13 User is offline   elam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 16-August 10

Posted 22 September 2010 - 08:52 AM

I'm having a problem with 1.5. In IE the close and navigation graphics don't show up. It is something with the paths with the AlphaImageLoader. I think it needs an absolute path but with the asset manager, I'm not sure how to do this. Does anyone have a fix?
0

#14 User is offline   sn0rcha 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 22-June 09

Posted 07 October 2010 - 01:58 AM

has anyone been able to get fancybox to work after you render a page with ajax?

Using this extension i get the following javascript error;

"u is undefined"

Any ideas?

I've put the widget in the view getting rendered.
0

#15 User is offline   hefi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 21-January 10
  • Location:Hungary

Posted 08 October 2010 - 04:24 AM

View Postjunxiong, on 04 August 2010 - 05:48 AM, said:

I want to close fancybox from other element. I wonder why the $.fancybox.close() doesn't take any effect? The error said "$.fancybox is undefined". Do you know why?


I've got the same problem.

The fancybox link:
                            <?=CHtml::link("jelentem", array('/report/create',
                                'sid'=>$comment->commentId,
                                'objtype'=>Report::OBJTYPE_CMT), array('id'=>'reportlink'))?>

<?php $this->widget('application.extensions.fancybox.EFancyBox', array(
        'target'=>'a#reportlink',
        'config'=>array(
                'scrolling'=>'no',
                'titleShow'=>true),
        )
);
?>


fancybox content:
<?
...
$script=<<<EOD
$('#cancellink').click(function() {
    $.fancybox.close();
});
EOD;
Yii::app()->clientScript->registerScript('fclose',$script);
?>

<a href="#" onClick="return false;" title="Close window" id="cancellink">mégsem</a>


If I click on cancellink I'll get '$.fancybox is undefined' error message :(
0

#16 User is offline   junxiong 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 541
  • Joined: 21-June 10

Posted 13 October 2010 - 01:16 PM

in order make $.fancybox be recognized, you must put the widget declaration in the same file with the $.fancybox.close().

Currently your closing fancybox code :
$.fancybox.close() 
must be in different file with this code
<?php $this->widget('application.extensions.fancybox.EFancyBox', array(
        'target'=>'a#reportlink',
        'config'=>array(
                'scrolling'=>'no',
                'titleShow'=>true),
        )
);
?>


isn't it?
“The most likely way for the world to be destroyed, most experts argue, is by accident. That’s where we come in; we’re computer professionals. We cause accidents.” - Nathaniel Borenstein

Yii Playground : Collaborative demo apps. You can join to improve it too!
My Team's Blog: In Indonesian.
0

#17 User is offline   talby101 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 26-August 10
  • Location:Wales

Posted 03 December 2010 - 10:27 AM

Hi there,

I have a hyperlink as a column value in zii.widgets.grid.CGridView which
has a class activated by fancybox. Works great but when you do a search through
CGridView the fancybox gets destroyed from the hyperlinks in the column value.
Do you know how I can reactivate fancybox after the search returns?

Cheers!

Spiro
0

#18 User is offline   thiagovidal 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 147
  • Joined: 17-February 10
  • Location:Brazil, São Paulo

Posted 03 December 2010 - 11:49 AM

create a new javascript function like this

function fancyboxRearm(target){
$(target).fancybox();
}

or

function fancyboxRearm(){
$(the target).fancybox();
}

on CGridView

afterAjaxUpdate='fancyboxRearm(the target)' //put the target selector...

remember to pass the config parameters again if you have setted on fancybox widget.

got it?
1

#19 User is offline   bmadeiro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 5
  • Joined: 30-June 09

Posted 10 December 2010 - 02:35 PM

View Postjunxiong, on 04 August 2010 - 05:48 AM, said:

I want to close fancybox from other element. I wonder why the $.fancybox.close() doesn't take any effect? The error said "$.fancybox is undefined". Do you know why?


To close fancybox from a link inside an iframe:

parent.$.fancybox.close();
0

#20 User is offline   Gautam Mahato 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 05-January 11
  • Location:Hof, Germany

Posted 28 January 2011 - 03:04 AM

I am getting error when starting with multiple instance of fancybox. Do u have any suggestion please reply me.
------------

Kind Regards,

Gautam Kumar
Hof, Germany
0

Share this topic:


  • (3 Pages)
  • +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users