Adding checkbox in admin table display I'm trying to add a checkbox column in the admin table part of my module.
The idea is to add checkboxes at the beginning of each row, like in the normal admin content management form.

My table is build in a form function with the following code :

function myform_admin_form($form, &amp;$form_state) { 

$query = db_select('form_xml', 'f');
$query-&gt;join('form_xml_status', 's', 's.id = f.id');
$query-&gt;join('users', 'u', 'u.uid = f.uid');
$result = $query
        -&gt;condition('s.status', 'todo', '=')
        -&gt;fields('f')
        -&gt;fields('u', array('name'))
        -&gt;execute()
        -&gt;fetchAll();

$header = array(
array('data' =&gt; t('ID')),  
array('data' =&gt; t('Name')),  
array('data' =&gt; t('User')), 
);

foreach($result as $key){
$rows[] = array(
array('data' =&gt; t($key-&gt;id)), 
array('data' =&gt; t($key-&gt;name)), 
array('data' =&gt; t($key-&gt;user))
);
} 

$form['table'] = array(
'#type' =&gt; 'tableselect',
'#header' =&gt; $header,
);

$output = theme('table', array('header' =&gt; $header, 'rows' =&gt; $rows));
$output .= $form;

return $output;

}


My tableselect doesn't display at all, but "Array" appears at the bottom of the table. Is it possible to add checkboxes in a table like this ?
Although there's actually no question, I've noted the last part of your code should look like:

&lt;?php

$form['table'] = array(
  '#type' =&gt; 'tableselect',
  '#header' =&gt; $header,
  '#options' =&gt; $rows,
);

return $form;