有没有办法让多个表格中的dhtmlx网格完全可编辑?

时间:2015-11-05 04:07:16

标签: php mysql multiple-tables dhtmlx

我有一个从多个表创建的dhtmlx网格。我可以编辑主表,但不能编辑连接的表。

dhtmlx指南在从多个表创建网格并使其完全可编辑时相当模糊。 我按照这里的步骤: http://docs.dhtmlx.com/connector__php__complex_queries.html#complexqueries http://docs.dhtmlx.com/connector__php__basis.html#loadingfromdatabase
并尝试创建连接,但失败了。 我正在使用他们的php-connector,我尝试的代码如下:

$jpnx_regs = new GridConnector($conn,'MySQL');                    // connector initialization
$jpnx_regs->sql->attach("Update","
UPDATE wp_japanextion_attendance_data
LEFT JOIN wp_buyer_employee
    ON wp_buyer_employee.ID = wp_japanextion_attendance_data.ID_employee
LEFT JOIN wp_buyer_company
    ON wp_buyer_company.ID = wp_buyer_employee.ID_company
SET
    reg_user='{reg_user}',
    reservation_date='{reservation_date}',
    reservation_hour='{reservation_hour}',
    copy_company_name='{copy_company_name}',
    copy_company_TEL='{copy_company_TEL}',
    copy_name='{copy_name}',
    copy_mobile_TEL='{copy_mobile_TEL}',
    copy_email='{copy_email}',
    rec_creation_date='{rec_creation_date}',
    iploc='{iploc}',
    trackvia_inserted='{trackvia_inserted}'
WHERE id='{id}'
");

$jpnx_regs->render_complex_sql("
SELECT 
*,  wp_japanextion_attendance_data.ID AS jpnx_ID,
    wp_buyer_employee.ID AS employee_ID,
    wp_buyer_company.ID AS buyer_ID,
FROM 
wp_japanextion_attendance_data
LEFT JOIN wp_buyer_employee
    ON wp_buyer_employee.ID = wp_japanextion_attendance_data.ID_employee
LEFT JOIN wp_buyer_company
    ON wp_buyer_company.ID = wp_buyer_employee.ID_company
    WHERE
reservation_date LIKE '%November%' OR
reservation_date LIKE '%December%' OR
reservation_date LIKE '%January%'

    ", "jpnx_ID","
    reg_user,reservation_date,reservation_hour,company_name,company_TEL,name,mobile_TEL,email,rec_creation_date,iploc,trackvia_inserted,ID
");

↑正如他们的导游说的那样。我首先像这样初始化网格:

$jpnx_regs = new GridConnector($conn,'MySQL');

然后我附上更新动作:

$jpnx_regs->sql->attach("Update"," ... sql code here

然后我使用render_complex_sql渲染网格。

$jpnx_regs->render_complex_sql("
顺便说一句,以防万一,这里下面是我的网格工作代码来自多个表,但我只能更新主表:

$jpnx_regs = new GridConnector($conn,'MySQL');
if ($jpnx_regs->is_select_mode())
    $jpnx_regs->render_sql("
SELECT 
*,  wp_japanextion_attendance_data.ID AS jpnx_ID,
    wp_buyer_employee.ID AS employee_ID,
    wp_buyer_company.ID AS buyer_ID,
FROM 
wp_japanextion_attendance_data
LEFT JOIN wp_buyer_employee
    ON wp_buyer_employee.ID = wp_japanextion_attendance_data.ID_employee
LEFT JOIN wp_buyer_company
    ON wp_buyer_company.ID = wp_buyer_employee.ID_company
    ", "jpnx_ID","reg_user,reservation_date,reservation_hour,company_name,company_TEL,name,mobile_TEL,email,rec_creation_date,iploc,trackvia_inserted,ID
");
else //code for other operations - i.e. update/insert/delete
    $jpnx_regs->render_table("wp_japanextion_attendance_data","id","
    reg_user,reservation_date,reservation_hour,copy_company_name,copy_company_TEL,copy_name,copy_mobile_TEL,copy_email,rec_creation_date,iploc,trackvia_inserted");

0 个答案:

没有答案