I need a little help in jQuery Mobile Foo Table. I am adding data dynamically in a table.
HTML:
<table id="tblSRNDetails" class="footable">
<thead>
<tr>
<th data-class="expand">SRN</th>
<th >Failure Date</th>
<th >Complaint Report Date</th>
<th>Promised Date</th>
<th >Customer Name</th>
<th >Log Time</th>
<th >Create FSR</th>
<th data-hide="phone,tablet">Days Open</th>
<th data-hide="phone,tablet">SRN Allocated Time</th>
<th data-hide="phone,tablet"> SRN Status</th>
<th data-hide="phone,tablet"> ESN Number</th>
<th data-hide="phone,tablet"> Request Type</th>
<th data-hide="phone,tablet">Service Request Details</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
js code:
$("#page-id").live('pagebeforeshow', function() {
console.log("Page before show");
$("#tblSRNDetails > tbody tr").remove();
for (var indx = 0; indx < 2; indx++ )
{
$("#tblSRNDetails > tbody").append("<tr>"+
"<td>Name</td>"+
"<td>failureDate</td>"+
"<td>complaintReportDate</td>"+
"<td>promisedDate</td>"+
"<td>custName</td>"+
"<td><a href='#'><b>Log Time</b></a></td>"+
"<td><b>Create FSR</b></td>"+
"<td>daysOpen</td>"+
"<td>allocatedTime</td>"+
"<td>srn_status</td>"+
"<td>ESNNumber</td>"+
"<td>requestType</td>"+
"<td>customerComplaint</td>"+
"</tr>");
}
$('#tblSRNDetails').footable();
});
With this FooTable is applied properly when opened for first time. If I click on home page button and go back, and come on that page again, the FooTable is not applied properly.
Screenshot:
So issues I am facing at that time include:
Hidden fields are shown. (Means Footable is not applied): This issue gets resolved after changing orientation in device for twice.
First field doesn't include Data Expand button anymore (Means Footable is not applied):
I think the issue is because I am removing the old rows and adding new ones. I tried without giving remove call. At that time, the old rows were being displayed properly. Newly appended fields were having problems as shown in screenshot.
Can someone help me with this?
P.S: I am rendering this in android webview. And same problem is reproduced in browser, too.
.live
is depreciated and replaced with.on
. Also, try adding this after appending items$('[data-role=page]').trigger('create')
. – Frizzly.on
didn't work. And I tried adding$('[data-role=page]').trigger('create')
after appending data. But that didn't change anything. – Disbud.on
should work if you're using jquery 1.8.3 and above. Have you addedtrigger('create')
after$('#tblSRNDetails').footable();
? Tryrefresh
orpagecreate
instead ofcreate
. – Frizzly$('#tblSRNDetails').footable();
And try to refresh and pagecreate both. Still same output. Is there any way of removing footable / refreshing it? – Disbud