Yii Framework Forum: Pop Up A New Windwon In Gridview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Pop Up A New Windwon In Gridview Rate Topic: -----

#1 User is offline   seanchen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 31-December 11

Posted 08 December 2012 - 01:00 PM

I have a grid view column name "record", I would like to click the record and pop up s new small window to display the detail of the record. I have read the classroom example a lot of times but i did not find the way
array(
'name'=>'Record',	
'type' => 'raw',
'value'=>'CHtml::ajaxlink($data["record"],array("cnc/showrecord","id"=>$data["record_id"]),array(\'update\'=>\'#record_detail\'))',,
   
'htmlOptions'=>array('bgcolor'=>'yellow','padding'=>'0.5em'),
),


The above code works but doesn't show in a new window.
Can someone help me? Thanks
0

#2 User is offline   Kostas Apazidis (KonApaz) 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,382
  • Joined: 21-February 11
  • Location:Greece

Posted 08 December 2012 - 05:34 PM

check something like that

'value'=>'CHtml::link(
array(
onclick'=>"MyWindow=window.open('http://www.yourlink.com','MyWindow','toolbar=no,location=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no,width=300,height=300'); return false;"
)
);',
Yii is the best php framework in the world!
It is also powerful and flexible for large scale websites
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

#3 User is offline   seanchen 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 31-December 11

Posted 09 December 2012 - 07:38 PM

Thanks Konapaz! I tried, but it doesn't work
0

#4 User is offline   dahuzizyd 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 26
  • Joined: 21-June 11

Posted 10 December 2012 - 03:00 AM

Now, the window.open is not recommend. Because many web browser's default set is prevent it.
You can use CJuiDialog in Yii framework , for example:
<?php 
  $this->beginWidget('zii.widgets.jui.CJuiDialog', array(
      'id'=>'mydialog',
      // additional javascript options for the dialog plugin
      'options'=>array(
          'title'=>'Dialog box 1',
          'autoOpen'=>false,
      ),
  ));
 
      echo 'dialog content here';
 
  $this->endWidget('zii.widgets.jui.CJuiDialog');
 
  // the link that may open the dialog
 echo CHtml::link('open dialog', '#', array(
     'onclick'=>'$("#mydialog").dialog("open"); return false;',
  ));
  ?>

0

#5 User is offline   Kostas Apazidis (KonApaz) 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 1,382
  • Joined: 21-February 11
  • Location:Greece

Posted 10 December 2012 - 01:52 PM

View Postseanchen, on 09 December 2012 - 07:38 PM, said:

Thanks Konapaz! I tried, but it doesn't work


You have to be careful (I had too) with quotes and double quotes. (it was a little complicated)
The previous post was an example without checking, Now I tried it in my test project and works fine!

Just paste this code in your CGridview and you will see that works! :)

array(
			'name'=>'Record',       
			'type' => 'raw',
			'value'=>"CHtml::link('testlink',array('controller/action'),
								array('onclick'=>'window.open(\'http://www.yourdomainlink.com\',\'mywindow\',\'status=1\'); return false;'
)
)",
),
",

Yii is the best php framework in the world!
It is also powerful and flexible for large scale websites
find our demo Yii extension on www.webkit.gr
Is it post useful? please v++ ;)
0

Share this topic:


Page 1 of 1
  • 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