I have the following implementation, which will render the results of a json in the screen. However, for test purposes, I had to comment the line
serviceRequestListTabsController.showActive(); below. Nevertheless, another project makes use exactly of the same implementation, and need to use the showActive() function. Thus, I cannot commit this code, otherwise I will break other people's code. How can I separate it using Spring, Interface, or whatever makes it easier? Thanks.
$(document).delegate('.menu .activeTab', 'tap', function () {
$.mobile.changePage("#pageHome", "fade", true, false);
$('.menu .activeTab').removeClass('active');
$('.menu .assignedTab').removeClass('active');
$('.menu .completedTab').removeClass('active');
$('#pageHome .activeTab').addClass('active');
//Delete button for completed call: it is showed only in Completed tab
$("#delCompletedCall").hide();
//--- My implementation
var messages = JSON.parse(localStorage.messages);
for (var i = 0; i < messages.length; i++) {
//TODO: To verify double enconded.
var message_data = JSON.parse(messages[i].message_data);
$("table.NA tbody").append(
"<tr>" +
"<td>" + message_data.statusArgument + "</td>" +
"<td>" + message_data.machineType + "</td>" +
"<td>" + message_data.serviceRequestRef + "</td>" +
"<td>" + message_data.territoryCE + "</td>" +
"<td>" + message_data.customerName + "</td>" +
"</tr>");
}
//--End my implementation.
//serviceRequestListTabsController.showActive();
});