CREATE VIEW view2 AS SELECT `wp_wpdatatable_1`.`wdt_ID`,
`wp_wpdatatable_1`.`name`,
`wp_wpdatatable_1`.`company`,
`wp_wpdatatable_2`.`newcolumn1`
FROM `wp_wpdatatable_1`, `wp_wpdatatable_2`
WHERE `wp_wpdatatable_1`.`wdt_ID` = `wp_wpdatatable_2`.`wdt_ID`
Resulting table in wpDataTables generated from SELECT * FROM view2:
"newcolumn1" can't be edited, because the proper ID (wdt_ID) was passed for wp_wpdatatable_1, not wp_wpdatatable_2 it is coming from, so editing needs to be turned off for that column in order to edit or add new data. When editing is enabled for "newcolumn1" I am able to add a new row:
But it will not be seen in the table because of the WHERE clause, and the fact that wp_wpdatatable_2 doesn't have wdt_ID = 3. However, if I check wp_wpdatatable_1 in the database, it's there:
Also, if I modify wp_wpdatatable_2, and add a new row (3):
It will be associated to wdt_ID = 3 from wp_wpdatatable_1 (Google), and if I add another row in wp_wpdatatable_2 (4):
It will also show up in the wpDataTable created from the view:
Can this be done?
create view View1 as select ID, NAME, OTHERFIELDVALUE from table1, table2 where table1.foreignID = table2.ID
The have the WPDT source be:
select * from View1
and be able to:
1) use the Main Search to filter records in the view
2) be able to edit any of the fields in View1
If yes, can you give me a complete example, as I've tried a few times and can't get it to work? I can get each to work BUT NOT at the same time?
thanks
Hi again Larry
As covered in multiple tickets during the day:
1. Yes, using view you will be able to search through the table
2. You can edit only one underlying table, if you pass the proper ID while creating the view.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
hi,
Can you explain what or how this is done? "pass proper ID when creating the view"
--- 2. You can edit only one underlying table, if you pass the proper ID while creating the view.
thanks
Hi again Larry
The ID of a row needs to be a unique auto-increment column. When you're joining multiple tables, wpDataTables needs to have the ID column for editing.
One underlying table can be edited if this ID is passed correctly, but not the other tables used in the view.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables
Thanks Aleksandar :)
I'm not trying to be hard, however, I'm not understanding this one statement:
"One underlying table can be edited if this ID is passed correctly"
So what exactly or where exactly or how exactly is that done?
Where is this ID passed?
How is it passed?
How do you tell which table to update?
These parts make sense:
- table ID needs to be auto-increment
- only can update 1 table (no matter how many are used in the View)
Simple example:
VIEW
create view View1 as Select tbl1.name, tbl2.team From tbl1, tbl2 Where tbl1.FKID = tbl2.PKID
WPDT
Select * from View1
So how do you update tbl1.name OR tbl2.team ?
thanks
Hi again Larry
Here's an example, using wpDataTables.
wp_wpdatatable_1:
wp_wpdatatable_2:
VIEW creation:
Resulting table in wpDataTables generated from SELECT * FROM view2:
"newcolumn1" can't be edited, because the proper ID (wdt_ID) was passed for wp_wpdatatable_1, not wp_wpdatatable_2 it is coming from, so editing needs to be turned off for that column in order to edit or add new data. When editing is enabled for "newcolumn1" I am able to add a new row:
But it will not be seen in the table because of the WHERE clause, and the fact that wp_wpdatatable_2 doesn't have wdt_ID = 3. However, if I check wp_wpdatatable_1 in the database, it's there:
Also, if I modify wp_wpdatatable_2, and add a new row (3):
It will be associated to wdt_ID = 3 from wp_wpdatatable_1 (Google), and if I add another row in wp_wpdatatable_2 (4):
It will also show up in the wpDataTable created from the view:
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables