on 09-05-2012 4:20 PM
Hi friends,
I developed a custom list using the following code in for Hybrid web container app.
function customBeforeShowScreen(screenToShow, screenToHide) {
if (screenToShow == "PurchaseOrdersDetail"){
menuItemCallbackPurchaseOrdersDetailGet_Po_Items();
var message = getCurrentMessageValueCollection();
var itemList = message.getData("PO_Items");
var items = itemList.getValue();
var numOfItems = items.length;
var i = 0;
//iterate through the results and build our list
//var htmlOutput = '<div><ul data-role="listview" data-theme="a" data-filter="true">';
var htmlOutput = '<div><ul data-role="listview">';
while ( i < numOfItems ){
var currItem= items[i];
var fecha = currItem.getData("PO_Items_PO_Item_attribKey").getValue();
var corrida = currItem.getData("PO_Items_Material_attribKey").getValue();
var nombre = currItem.getData("PO_Items_Quantity_attribKey").getValue();
//for our list, we want a thumbnail icon, which is why the image goes first
htmlOutput += '<li><a id ="' + currItem.getKey() + '" class="listClick">';
//htmlOutput += '<img src="./images/' + "avatar.png" + '" class="ui-li-thumb">';
htmlOutput += '<h3>' + nombre +'</h3>';
htmlOutput += '<p>' + fecha +'</p>';
htmlOutput += '<p>' + corrida +'</p>';
htmlOutput += '</a></li>';
i++;
}
htmlOutput += '</ul></div>';
var topOfFormElem1 = document.getElementById("POItems");
topOfFormElem1.innerHTML = htmlOutput;
$(".listClick").click(function(){
currListDivID = $(this).parent().parent();
navigateForward("PurchaseOrdersDetail", this.id );
if (isBlackBerry()) {
return;
}
});
return true;
}
return true;
}
The list is showing properly for the first time like the below
But when I refresh the list with an online request the style is not showing.
Now the list is showing like this:
Is there any way to solve this issue?
It happens in Ios and android. I didn't check with BB.
Regards
Midhun.V.P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following code might help you, I having similiar issues before when implementing similiar function, and I reliaze for the first time you can't use
"$('ul').listview();"
it will cause the page somehow unable to load, so i only apply the code when the navigate to the view for second time.
anyway following are my way of doing it, hope it helps:-
// Refreshing View
var divContent = document.getElementById('batch_item_content');
if (divContent != null){
divContent.innerHTML = headerHtml + segmentControlHtml + html;
// Refresh View After Modifying Data
$('ul').listview();
}else{
$('#Batch_ItemForm #batch_item_html').parent().after('<div id="batch_item_content">' + headerHtml + segmentControlHtml + html + '</div>');
}
Hey Shin,
I solved this issue. But the list is not updating in anyway. New items are not adding into the list even the MBO is updated.
Following is the code:
function customBeforeShowScreen(screenToShow, screenToHide) {
if (screenToShow == 'Purchase_Orders')//Custom Appl MBO key name
{
//menuItemCallbackPurchase_OrdersRefresh();
//alert("screenKey :");
var message = getCurrentMessageValueCollection();
var itemList = message.getData("Purchase_Systech");
var items = itemList.getValue();
var numOfItems = items.length;
var i = 0;
alert("number"+ numOfItems);
//var htmlOutput = '';
var htmlOutput = '<div id="supportViewList"><ul data-role="listview" data-filter="true">';
//var htmlOutput = '<div><ul>';
while ( i < numOfItems ){
var currItem= items[i];
var PO_NUMBER = currItem.getData("Purchase_Systech_PO_NUMBER_attribKey").getValue();
var CREATED_ON = currItem.getData("Purchase_Systech_CREATED_ON_attribKey").getValue();
var VENDOR = currItem.getData("Purchase_Systech_VENDOR_attribKey").getValue();
var TOTAL_PRICE = currItem.getData("Purchase_Systech_TOTAL_PRICE_attribKey").getValue();
//var res_date = currItem.getData("Reschedule_order_res_date_attribKey").getValue();
htmlOutput += '<li><a id ="' + currItem.getKey() + '" class="listClick">';
//htmlOutput += '<div class="fsservices_white">';
//htmlOutput += '<div class="ui-grid-d">';
htmlOutput += '<div>'+PO_NUMBER+'           '+CREATED_ON+'                  '+TOTAL_PRICE+'         '+VENDOR+'</div>';
//htmlOutput += '<div class="mid1">'+res_date+'</div>';
//htmlOutput += '<div class="ctr" >' + fname + ' ' + lname +'</div>'
//htmlOutput += '<div class="rgt" ><img src="images/arrow.png" title="sample"/></div>';
//htmlOutput += '<div class="mid" >'+prodesc+'</div>';
//htmlOutput += '</div>';
//htmlOutput += '</div>';
htmlOutput += '</a></li>';
i++;
}
htmlOutput += '</ul></div>';
var listview = $('div[id="supportViewList"]');
if (listview.length > 0) {
var ul= $(listview[0]).find('ul[datarole="listview"]');
if (ul.length > 0) {
//htmlOutput = htmlOutput.replace('<div id="supportViewList"><ul data-role="listview" data-filter="true">','');
//htmlOutput = htmlOutput.replace("<div id="supportViewList"><ul data-role="listview" data-filter="true">","");
alert("htmlOutput");
ul.html(htmlOutput);
ul.listview('refresh');
}
}
else{
var topOfFormElem1 = document.getElementById("HTML2");
topOfFormElem1.innerHTML = htmlOutput;
//$('#Purchase_OrdersScreenDiv #Purchase Orders').hide();
//$('#topOfPurchase_OrdersForm').after(htmlOutput);
//$('#Purchase_OrdersForm').children().eq(2).hide();
//$('#Purchase_OrdersForm').children().eq(3).hide();
//$('#Purchase_OrdersForm').children().eq(1).after(htmlOutput);
}
//htmlOutput +='';
//alert("htmlOutput :"+htmlOutput);
$(".listClick").click(function(){
O_resId = this.id;
navigateForward("Purchase_Order_Details", this.id );
if (isBlackBerry()) {
return;
}
});
return true;
}
Can you give a solution for this.
Thanks
Midhun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.