Code shared between table and editor gadgets
