select from database view, update table

Questionsselect from database view, update table
Wing asked 1 year ago

Hi,
my grid is populated by a database view:
$g->select_command = “SELECT * FROM v_rpt_customer_orders”;
 
The update table is different from the view:
$g->table = “orders”;
 
the view is a join of the customers and orders table, and the grid shows some customer info and their orders.
All of the columns are read only except for 1 column, item_status. I want to be able to update the item_status in the orders table. How can this be done?
Thanks

2 Answers
Abu Ghufran Staff answered 1 year ago

The update should work if you set different sql and table property. All editable columns are posted on update so if you limit them to the table of orders, it will post PK (first column) and editable columns present. The order table should have PK,item_status in it. You can also have on_update callback function to process manually.

_________________________
Abu Ghufran - Dev Team
PHP Grid Framework
 
Wing answered 1 year ago

That fixed it, Abu. Thanks. Followup question: with the on_update callback, the default save still gets executed before the on_update code gets executed. Is there a way to prevent this?

Wing replied 1 year ago

I think i found it. Set the last parameter to false. yes?

Abu Ghufran Staff replied 1 year ago

Yes, correct.

Your Answer

2 + 9 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!