select from database view, update table

Questionsselect from database view, update table
Wing asked 6 years 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 6 years 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
Grid 4 PHP Framework
 
Wing answered 6 years 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 6 years ago

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

Abu Ghufran Staff replied 6 years ago

Yes, correct.

Your Answer

20 + 12 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?