Enable In-place Editing in Yii Grid

Today someone asked me for help to integrate Jeditable with Yii CGridView. So I thought why not write a little tutorial that can help others as well. In this article I assume that you are comfortable working with Yii; you are able to create Yii web applications and use Gii module to create models. Also, […]

Customize CKEditor

 To add a new font in CKEditor’s font drop down list, add the following lines of code in your config.js   CKEDITOR.editorConfig = function( config ) { config.font_names ="Futura;" + config.font_names; }; CKEDITOR.on( ‘instanceCreated’, function( e ){ e.editor.addCss("@font-face{font-family:’Futura’; src:url(‘http://www.your-url.com/font/Futura_Medium.ttf’);" ); });   To customize Toolbars of CKEditor, add the following lines of code in you […]

Debug JavaScript in Internet Explorer

Source: http://www.jonathanboutelle.com/how-to-debug-javascript-in-internet-explorer Microsoft Office 2007: The Microsoft Script Editor is normally installed by default with Office 2007, but is not reachable directly from the Start -> All Programs -> Microsoft Office menu.  Instead, you can usually find it by searching for MSE7.EXE on the local drives.  On the machine I am working on now, it is […]

iFrame in jQuery UI Dialog

To display iFrame in jQuery UI Dialog, use the following code. <html> <head> <link rel="stylesheet" href="./styles/smoothness/jquery-ui-1.7.2.custom.css" type="text/css" media="screen" /> <script type="text/javascript" src="./scripts/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="./scripts/jquery-ui-1.7.2.custom.min.js"></script> <script type="text/javascript"> $(function() { $('a').click(function(e) { e.preventDefault(); var $this = $(this); var horizontalPadding = 30; var verticalPadding = 30; $('<iframe id="externalSite" class="externalSite" src="' + this.href + '" />').dialog({ title: ($this.attr('title')) […]

Control parent window’s location from a popup

Step 1:  In your parent window document add a function function changeURL(url) { if( url == ""){ url = document.location.href; } document.location.href = url; }   Step 2: In popup document call this function to change URL of parent window opener.document.changeURL(‘http://www.google.com/’);  If you only want to refresh parent’s window, use the following statement. opener.document.location.reload();  

Control parent window’s location from an iframe

Step 1:  In your parent window document add a function function changeURL(url) { if( url == ""){ url = document.location.href; } document.location.href = url; }   Step 2: In iframe document call this function to change URL of parent window parent.document.changeURL(‘http://www.google.com/’);  If you only want to refresh parent’s window, use the following statement. parent.document.location.reload();  

Ajax button in CGridView

To add an ajax button to CGridView modify the buttons column  as   ‘columns’ => array( ‘id’, ‘name’, array( ‘class’=>’CButtonColumn’, ‘template’ => ‘{view} {update} {delete}’, ‘buttons’=>array( ‘view’ => array( ‘url’=>’"index.php?r=admin/view&id=".$data->user_id."&m=users"’, ‘click’ => "function (){ $(‘#viewTab’).load($(this).attr(‘href’));return false; }" ) ), ), )  

Display loading div when executing ajax requests

In html add the following div right before closing body tag <div class="ajax-loading"><div></div></div>   Add the following CSS code to stylesheet. (Download loading-bgr.gif and loading.gif) div.ajax-loading{ position: fixed; top: 0; left: 0; height:100%; width:100%; z-index: 9999999; background-image: url(‘../../images/loading-bgr.gif’); opacity: 0.7; filter: alpha(opacity=70); /* ie */ -moz-opacity: 0.7; /* mozilla */ display:none; } div.ajax-loading * { […]