发布于 2016-12-14 03:56:19 | 162 次阅读 | 评论: 0 | 来源: 网友投递
			ExtJS Javascript库
ExtJS是一种主要用于创建前端用户界面,是一个基本与后台技术无关的前端ajax框架。		
this.departmentStore = new Ext.data.JsonStore({ 
proxy: new Ext.data.HttpProxy({url: "http://localhost:8080/Test_EXT/DB/Department.php"}), 
fields: ["department_code", "department_name", "manager", "division_code"] 
}); 
<?php 
require('JSON.php'); 
require('uai_Personal_Info.php'); 
$p = new uai_Personal_Info(); 
$result = $p->getDepartmentList(); 
$json = new Services_JSON(); 
echo $json->encode($result); 
还有一点要修改的就是新增和修改窗体的onSubmitClick方法 
onSubmitClick: function() { 
if (this.url != "") { 
this.form.submit({url: this.url, success: this.onSubmit, 
waitTitle: "Save Data", waitMsg: "Transcation process.....", scope: this}); 
this.fireEvent("submit", this, this.form.getValues()); 
} 
}, 
<?php 
require('JSON.php'); 
require('uai_Personal_Info.php'); 
$rs = $_POST; 
$rs["success"] = true; //表示处理成功 
$sql = "INSERT INTO uai_department(department_code, department_name, manager, division_code) VALUES('" . 
$_POST["department_code"] . "', '" . $_POST["department_name"] . "', '" . $_POST["manager"] . "', '" . $_POST["division_code"] . "')"; 
$p = new uai_Personal_Info(); 
$rs["r"] = $p->insert_department($sql); 
$json = new Services_JSON(); 
echo $json->encode($rs); 
remove: function() { 
var r = this.getActiveRecord(); 
Ext.Ajax.request({url: "http://localhost:8080/Test_EXT/DB/delete_dept.php", params: {department_code: r.get("department_code")}}); 
this.getStore().remove(r); //删除客户端数据 
},