我正在嘗試構建一個應用程序供用戶提交他們的工作時間,但在將其他數據拉入網格時遇到問題。例如:如果用戶要在僱員代碼欄輸入員工代碼0000,員工姓名字段需要更新以讀取「John Doe」所有這些數據存儲在後端數據庫中,而我已經能夠刷新訪問它,例如。如果在創建新行並且存在數據之後重新加載頁面,則會將正確的數據拉入,但我不希望它們必須刷新頁面才能執行此操作。如何在更新單元格後獲取額外的數據。DHTMLX Grid拉取其他數據
網格是在頁面上創建用JavaScript如下:
timesheetGrid.setColumnIds("Column Names, Column Names");
timesheetGrid.setImagePath("codebase/imgs/"); //set the image path for the grids icons
timesheetGrid.setInitWidths("70,100,100,100,70,100,150,100,70,70,100,70,70,*,*"); //sets the initial widths of columns
timesheetGrid.setColAlign("center,center,center,center,center,center,center,center,center,center,center,center,center,left,left"); //sets the alignment of columns
timesheetGrid.setColTypes("edn,ro,dhxCalendar,ro,edn,ro,ed,ro,ro,ro,ed,edn,ch,txt,ro"); //sets the types of columns
timesheetGrid.setColSorting("str,str,date,date,str,str,str,str,str,str,str,str,str,str,str"); //sets the sorting types of columns
timesheetGrid.setDateFormat("%Y-%m-%d"); //Set the Date Format to be used in the Grid
timesheetGrid.attachHeader("#text_filter,#text_filter,#text_filter,,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,#text_filter,,,");
timesheetGrid.setColumnHidden(3,true);
timesheetGrid.enableEditEvents(true,false,true);
timesheetGrid.init();
//timesheetGrid.makeFilter("WeekEnding",0); //TODO: Add Filter For Week Ending
//this.lockRow(id, true); //Make Specific Row Read Only TODO: Non Active Week Rows Read Only
timesheetGrid.load("data/timesheets.php");
var dpg = new dataProcessor("data/timesheets.php");
dpg.enableDataNames(true); // will use names instead of indexes
dpg.init(timesheetGrid);
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
SQL Code is HERE
}else { //code for other operations - i.e. update/insert/delete
OTHER SQL CODE IS HERE
}
作爲數據提取數據是敏感我不能顯示任何的不便之處,敬請原諒。 任何幫助將不勝感激。
數據從MySQL數據庫 –
未來的數據庫是無關緊要的,你timesheets.php我想既然你不發送格式參數,因此該解決方案必須工作生成一個XML文件。 – user2844810
時間表php的內容高於唯一缺少的代碼是sql語句,因爲我無法給出我們的數據結構。我會嘗試使用上面xml命令的更新併發布我的發現 –