When looking at the manual it says:
Does that mean as well the field-name on the left AND right in the {} should both be the name of the field from render_sql?
↳ name=‘{name}’
When looking at the manual it says:
Does that mean as well the field-name on the left AND right in the {} should both be the name of the field from render_sql?
↳ name=‘{name}’
Yes, the name markers is the same as names of fields in the render_table or render_sql command.
If you have code like
render_table($sql, "id", "f1,f2,f3");
You can use markers as {id}, {f1}, {f2}, {f3}
I tried a few things, but seem to fail to get it to work.
This is my connector code for rendering the table:
[code]$jpnx_regs = new GridConnector($conn,‘MySQL’);
$jpnx_regs->enable_log(“dxhtml.log”);
if ($jpnx_regs->is_select_mode())
$grid->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}’
");
$grid->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,
ids,
ID
");[/code]
The questions:
I’m not sure wether the { } need to have apostrophe’s or not: ‘{ }’ because in the guide both ways are used in the same line… ‘{name}’,{price}
I’m not sure what should go in the " … " in the following line:
Apostrophes are necessary for string values ( code will escape data before placing in the SQL, but doesn’t add quotes automatically )
I’m not sure what should go in the " … "
You can use any SQL here, that will be used for data loading.
As for the posted code, you have a quite strange line there
if ($jpnx_regs->is_select_mode()) $grid->sql->attach(“Update”,"
This line defines the custom “update” action during select requests only. Most probably you need to remove the is_select_mode check.