I am trying to create a grid that pulls data from multiple tables which I have successfully done.
However I cannot work out how to insert/update/delete data from my main source table.
I am using a mySQL database I have the following code in a file called timesheets.php:
[code]include_once ‘…/includes/db_connect.php’;
require(“…/codebase/connector/grid_connector.php”);//adds the connector engine
$conn = new GridConnector($res,“MySQL”); //initializes the connector object
if ($conn->is_select_mode()) {//code for loading data
$conn->render_complex_sql(“SELECT
INF_TimeEntries.EmpCode,
INF_EmployeeList.EmpName,
INF_TimeEntries.TrnDate,
INF_TimeEntries.Project,
tINF_ProjectList.Description,
CASE IFNULL(INF_TimeEntries.JoineryItem,‘’) WHEN ‘’ THEN ‘NA’ ELSE INF_TimeEntries.JoineryItem END AS JoineryItem,
CASE IFNULL(Inf_Jobs.jmpPartShortDescription,‘’) WHEN ‘’ THEN ‘Job Removed’ ELSE Inf_Jobs.jmpPartShortDescription END AS jmpPartShortDescription,
Inf_Jobs.ujmpLevel,
Inf_Jobs.ujmpRoom,
INF_TimeEntries.WorkType,
INF_TimeEntries.Hrs,
INF_TimeEntries.IsReDo,
INF_TimeEntries.JCNotes
FROM INF_TimeEntries
LEFT OUTER JOIN INF_EmployeeList ON INF_EmployeeList.EmpCode = INF_TimeEntries.EmpCode
LEFT OUTER JOIN tINF_ProjectList ON tINF_ProjectList.Project = INF_TimeEntries.Project
LEFT OUTER JOIN Inf_Jobs ON Inf_Jobs.jmpProjectID = INF_TimeEntries.JoineryItem”,
“ID”,
“EmpCode,
EmpName,
TrnDate,
Project,
Description,
JoineryItem,
jmpPartShortDescription,
ujmpLevel,
ujmpRoom,
WorkType,
Hrs,
IsReDo,
JCNotes”);
}
else { //code for other operations - i.e. update/insert/delete
$conn->render_table(“INF_TimeEntries”, “ID”, “EmpCode, Project, Hrs, TrnDate, WorkType, IsReDo, JCNotes, JoineryItem”);
}[/code]
And this code in my main app to connect the two:
timesheetGrid.init();
timesheetGrid.load("data/timesheets.php"); //takes the path to your data feed
var dpg = new dataProcessor("data/timesheets.php");
dpg.enableDataNames(true);
dpg.init(timesheetGrid);
The Grid displays all the data correctly and as I need it too but whenever I update a row I get the bold text to indicate something has changed for a few seconds and then it returns to the normal text to indicate the update is complete. No errors are presented and everything appears to have worked but on page refresh the changes that have been made are not present.
Any help would be very much appreciated.