Switching edit mode of table at run time

I have an UI with browser and editor in one screen where editor table is inline editable. When I save after edit, I used the following code to turn off the the edit mode of the table:

table.setEditable(false);

it works well. However, I have to initialize the table in edit mode in order to enable editing. What I want is, the edit table will be initialized in uneditable mode but when the user clicks on Edit button from the browser part of the screen, the table will turn on edit mode.

My question is, how can I add this line of code in edit button standard action?