Difference between #1 and #2 of
Create custom button button with AJAX function in CGridView

Revision #2 has been created by nkd on Oct 24, 2012, 8:41:04 AM with the memo:

Corrected markdown anchor links
« previous (#1)


Title unchanged

Create custom button button with AJAX function in CGridView

Category unchanged


Yii version unchanged

Tags unchanged

ajax request, CGridView

Content changed

1. [Introduction](#Intro)
2. [How to](#Howto)
3. [One example](#example)
<a id="Intro">Introduction</a>
### Introduction CButtonColumn in CGridView can be customised to include user built buttons. To learn a great deal about including custom buttons, [read this excellent wiki](http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/ "this excellent wiki"). This tutorial will show how to call an action from one custom button using **AJAX** instead of regular GET calls. <a id="Howto">How to</a>
### How to
1. Create a custom button in your grid. You can follow [this tutorial](http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/ "this excellent wiki") for that.
2. In the 'url' parameter of your button, you call your controller action:
This will call the controller function using AJAX instead of redirecting the user to the url using GET parameters.

<a id="example">Example</a>
### Example
We will create a button that sends email to the user and then prints a success flash screen.

5 0
Viewed: 67 685 times
Version: 1.1
Category: How-tos
Written by: nkd
Last updated by: nkd
Created on: Oct 23, 2012
Last updated: 11 years ago
Update Article


View all history