duanjue7508 2016-03-08 21:07
浏览 94
已采纳

DHTMLX网格提取额外数据

I am trying to build an app for users to submit their work times in but am having trouble with pulling additional data into the grid.

Eg: If a user were to type in there employee code of 0000 into the Employee Code Column the Employee Name Field would need to update to read "John Doe" All this data is stored in databases on the back end and I have been able to access it on refresh eg. If the page is reloaded after the new row has been created and the data is present it will pull the correct data in, but i do not want them to have to refresh the page to do this. How can I pull in the extra data after the cell has been updated.

The Grid is created on the page with JavaScript as follows:

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 is used to pull data from the correct avenues

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
}

As the Data is sensitive I cannot display any of it sorry for any inconvenience. Any Help would be much appreciated.

  • 写回答

1条回答 默认 最新

  • duannao3819 2016-03-09 22:08
    关注

    If the data you're providing is XML you can attach an event to your grid and call this grid.updateFromXML("data/timesheets.php"); This will parse and paint the whole grid information

    If you're looking to update just the row you updated you can send via GET the id of the row and it will only parse and paint the row you're sending grid.updateFromXML("data/timesheets.php?for=" + row_id));

    Full Code would be something like this:

    dpg.defineAction ("update", myUpdate);
    function myUpdate(tag){
        timesheetGrid.updateFromXML("data/timesheets.php?for="+tag.getAttribute("sid"));
        return true;
    }
    

    If the data you're retrieving is not XML formatted, I'm afraid you would need to update the values from the row manually via the same event.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog