As far as I understand the scenario, you wish to have a custom button that shows locked/unlocked icon based upon a property in the dataSource. The icons should also switch to the opposite when clicked. If that is the case, here is a very simple Dojo example demonstrating a possible implementation.
Let me know if that works for you. If not, kindly get back to me with some information what would you wish changed.
Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic. Our thoughts here at Progress are with those affected by the outbreak.