DHTMLX 前端框架 建立你的一个应用程序 教程(十)--保存表单中的数据

保存表单中的数据

  现在我们所要做的是 当用户点击提交按钮的时候  我们将表单中的数据进行保存操作。

  我们可以使用dhtmlxDataProcessor. 来进行操作。它是一个数据组件,可以提供与服务器端的通信和交互。  它监控所有的数据更改  可以与服务器进行增删改查的操作

  这里我们需要的是进行更新的操作

保存更改的数据到后台

  1.在首页中我们添加一下代码

  

 'index.html' file

var dpg = new dataProcessor("data/contacts.php");         //inits dataProcessor
dpg.init(contactsGrid);   //associates the dataProcessor instance with the grid

  

  2.给它添加一个onButtonClick 事件

  

 'index.html'

contactForm.attachEvent("onButtonClick", function(name, command){
    contactForm.save();     //sends the values of the updated row to the server
 });