The select column toggle button dont work when create the table dynamically (Table data-mode="columntoggle")

The select column toggle button dont work when create the table dynamically (Table data-mode="columntoggle")

Hi, my name is Juan Pablo.
First of all. Sorry for my poor english.

My problem is that i append to my html table all the data dynamically (Columns and Rows).
So, when the render  finish i got my table complete but when i click the button "Column.."  to select Columns to show or hide. this don't show me the popup windows
I think is because I add the columns to my table dynamically

I'm Using the released version 1.3.1 of jquery mobile
With phonegap to develop a cross-platform app
I copy here my html code at first
  1. <div data-role="content" id="content">
  2. <div style="overflow: scroll" id="divTable">
  3. <table style="position: relative;" id="TableMonitor"
  4. data-role="table" data-mode="columntoggle"  class="ui-responsive                                           table-stroke table-stripe">
  5. </table>
  6. </div>
  7. </div>
Then I use javascript to append the columns at first like this

  1. var tablaHTML = new String();

  2. tablaHTML = '<thead> \
  3. <tr  class="ui-bar-d"><th/> ';
  4. for (i = 0; i < columns.length; i++) {
  5. if (columns[i].orden != -1) {
  6. tablaHTML += "<th data-priority='1'>" + columns[i].titulo
  7. + "</th>";
  8. }
  9. }
  10. tablaHTML += '</tr ></thead>';
  11. $("#TableMonitor").append(tablaHTML);

And I do the same thing to the <tbody>

Then after every render i use the refresh method
$("#TableMonitor").table("refresh");


How can i do to get the Column select button to work correctly?