Action Bar Buttons (Ajax) - Grid- Where to place script function?

Action Bar Buttons (Ajax) - Grid- Where to place script function ?

There is no availability of Javascript Methods under Programming for GRIDS. I have a script for a button. Where do I put that script? For Forms, I just added a function under Programming.