Grid Extjs: Checkbox Selection
this section, i want to share about using Checkbox Selection on Grid Extjs, here i have used Checkbox Selection to editing and deleting file from grid. I got this tutorial from www.extjs.com, then I combine with php to manipulate database data, such as editing and deleting files. Plugin which used here was checkbox selection.
The most important script in this tutorial is as follow
var Checkbox = new Ext.grid.CheckboxSelectionModel();
Below is the screen shot of this tutorial, you can editing file if you have selected a checkbox. and you can also deleting file if you have selected one or more checkbox.
And following some of the files needed to making “Grid Extjs: Checkbox Selection” tutorial.
Frist step is create a table on database, name’s table of this tutorial is simpleform. This table have more field are id, name, address, and email. and primary key of this field is id.
CREATE TABLE IF NOT EXISTS `simpleform` ( `id` int(11) NOT NULL auto_increment, `name` varchar(50) NOT NULL, `address` varchar(50) NOT NULL, `email` varchar(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- Dumping data for table `simpleform` -- INSERT INTO `simpleform` (`id`, `name`, `address`, `email`) VALUES (1, 'faisal amir', 'jl Pamekasan 87', 'faisal@yahoo.com'), (2, 'kahayan', 'blitar no 3', 'kahayan@yahoo.its'), (3, 'abid', 'lumajang', 'abid@gmail.com'), (4, 'Billy', 'lumajang', 'billy@gmail.com'), (5, 'didik', 'pamekasan', 'didik@plasa.com'), (6, 'kakase', 'saikato', 'kakase@yahoo.com'), (7, 'yudik', 'sikio', 'yudik@gmail.com');
Second step is create a php file to connect to database, database is a important to runing this tutorial. name`s database of this tutorial is defafe.
Example: name of this file is koneksi.php
$nameserver = "localhost";
$username = "root";
$password = "";
$dbname = "defafe";
mysql_connect($nameserver,$username,$password)or die('error'.mysql_error());
mysql_select_db($dbname);
?>
Third step is Create html file to call or includ javascript and css files.
Note The most important of this file is sequence of this file can not be replaced.
Below are the sequences of this file
1. include ext-all.css
2. include ext-base.js
3. include ext-all.js
4. include simplegrid.js
Example: name of this file is index.html
