Jump to content


Set value on add_action

add_action value set edit action

  • Please log in to reply
3 replies to this topic

#1 Dhan Pra Setya

Dhan Pra Setya

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 15 June 2015 - 10:35 AM

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!



#2 Paul Savostin

Paul Savostin

    Advanced Member

  • Members
  • PipPipPip
  • 229 posts
  • LocationUkraine

Posted 15 June 2015 - 08: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).



#3 aronsereny

aronsereny

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 22 November 2015 - 09: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



#4 Paul Savostin

Paul Savostin

    Advanced Member

  • Members
  • PipPipPip
  • 229 posts
  • LocationUkraine

Posted 23 November 2015 - 04:31 PM

LOL, sorry I cant post here simple staff about requesting DB, this is what u need to invistigate by yourself ;)







Also tagged with one or more of these keywords: add_action, value, set, edit, action

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users