How To Add A Button Or Checkbox To A Tableview?

Hello,

 

Below is code someone replied to me to show how to add columns to a tableView. What i would like to know is how to add another control in a column of a tableView? For example, I may want to add a checkbox in a column. Can someone show me how to do this? I notice a row has display.newText. Would I do something like widget.newSwitch? And set the properties for it in the same line?

 

local function onRowRender( event ) local row = event.row local rowGroup = event.view local halfh = row.height \*0.5 --add first column row.col1 = display.newText( "Column1: ",50,halfh, native.systemFont, 12 ) row.col1:setReferencePoint( display.CenterLeftReferencePoint ) row.col1.x= 50 row.col1.y = halfh row.col1:setTextColor( 0 ) --add second column row.col2 = display.newText( "Column2: ",150,halfh, native.systemFont, 12 ) row.col2:setReferencePoint( display.CenterLeftReferencePoint ) row.col2.x= 150 row.col2.y = halfh row.col2:setTextColor( 0 ) --add col1 and col2 to the row group rowGroup:insert( row.col1 ) rowGroup:insert( row.col2 ) end