Hi, I want to know if ADD ACTION can set/change value on certain columns in my case, I want to set 'publish' column from 'article' table which has value 1 for public, 0 for private. I have idea to use callback, but I haven't know which one. Any idea? Thanks in advance!
Set value on add_action
- Single Page
Posted 15 June 2015 - 10:35 AM
Posted 15 June 2015 - 20:57 PM
So what is the problem?
Correct me if I am wrong:
You have each row with ADD_ACTION button, while clicking on it you need change some field of this row in database, for example set 0 or if it already 0 set to 1, right?
If so - create method in you controller for this ADD_ACTION where you get PRIMARY KEY of current row, then request to database to get this row interested you field, check it - if 0 then you should set 1, otherwise set 0.
After just redirect to the list (mean method where you adding add_action to the Grocery Crud).
Posted 22 November 2015 - 21:37 PM
Paul,
"You have each row with ADD_ACTION button, while clicking on it you need change some field of this row in database, for example set 0 or if it already 0 set to 1, right?"
that is exactly what I need to do; i am new to grocery crud, can you give me a few lines about this method...
how to get request to DB?
how to write back new value?
how to redisplay the grid?
thanks,
aron
Posted 23 November 2015 - 16:31 PM
LOL, sorry I cant post here simple staff about requesting DB, this is what u need to invistigate by yourself ;)