XML : DHTMLX Grid - Update XML File using Data Processor

I am very new to Javascript & XML and have very basic knowledge of PHP.

I have created a website with a DHTMLX Grid on it that loads data from an XML File correctly but I now need to use a data processor to save new data back to the file. The Point of the Grid is a timesheet for external contractors app that I am building and I need the data in XML Format so that it can be imported into a database by the end client.

How do I go about this?

I have setup and initialised the data correctly at least I believe so. Here is the code for my Grid.

          <script>          var Timesheet_Grid, Timesheet_DataProcessor ;          function doOnLoad(){              Timesheet_Grid = new dhtmlXGridObject('gridbox');              Timesheet_Grid.setImagePath("codebase/imgs/");              Timesheet_Grid.setHeader("Employee Code, Work Date, Project No, Joinery Item, Work Type, Start Time, End Time, Payroll Note, Job Note");              Timesheet_Grid.setInitWidths("100,*,*,*,*,*,*,*,*,*");              Timesheet_Grid.setColAlign("left,left,left,left,left,left,left,left,left");              Timesheet_Grid.setColTypes("ed,dhxCalendar,ed,ed,ed,ed,ed,ed,ed");              Timesheet_Grid.setDateFormat("%Y/%m/%d");              Timesheet_Grid.enableAutoHeight(true);              Timesheet_Grid.init();              Timesheet_Grid.load("xml/timesheets/<?php echo $Name?>_timesheet.xml","xml");              //              Timesheet_DataProcessor = new dataProcessor("includes/update_all.php"); // WHAT GOES IN THIS FILE????              Timesheet_DataProcessor.setTransactionMode("POST",true); // set mode as send-all-by-post              Timesheet_DataProcessor.setUpdateMode("off"); // disable auto-update              Timesheet_DataProcessor.init(Timesheet_Grid); // link dataprocessor to the grid          }             function addRecord() {              var rowId=Timesheet_Grid.getRowsNum() + 1;              Timesheet_Grid.addRow(rowId,['','','','','','','','','','',''],Timesheet_Grid.getRowIndex(Timesheet_Grid.getSelectedId()));          }  </script>    

Here is the HTML For the GRID Itself

  <input type="button" name="New Entry" value="New Entry" onclick="addRecord()">    <input type="button" name="Delete Selected Row" value="Delete Selected Row" onclick="Timesheet_Grid.deleteSelectedItem()">    <input type="button" name="Save Data" value="Save Data" onclick="Timesheet_DataProcessor.sendData();">    <center>      <div id="gridbox" style="width:100%"> </div>    </center>    

Any Help in this situation is greatly appreciated.

No comments:

Post a Comment