Hi,
I am developing an application for android and iOS in application i want show list view in parent list-item i.e. List view in side list view. I have done code as follows but its not able to view inner list view.
Inner list view don not shows items but list is created .
Please do need full help.
//Parent List
var templatemyParentHome = getHomeParentListTemplate();
// ListView item array
var data = [];
for (var i = 0; i < 4; i++) {
//ChildList
var templatechilds = getHomeChildListTemplate();
// ListView item array
var childData = [];
for (var j = 0; j < 4; j++) {
childData.push({
childsite : {
text : 'SiteName ' + j
},
childmainImage : {
image : 'http://wtop.com/wp-content/uploads/2014/12/Home-Construction-1880x1111.jpeg',
// image : '/images/img2.jpg',
},
properties : {
itemId : 'row' + j,
accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_NONE
}
});
}
// ListView section
var childSection = Ti.UI.createListSection({
items : childData
});
data.push({
site : {
text : 'SiteName ' + i
},
mainImage : {
image : 'http://wtop.com/wp-content/uploads/2014/12/Home-Construction-1880x1111.jpeg',
// image : '/images/img2.jpg',
},
listChild : {
templates : {
default : templatechilds
},
defaultItemTemplate : 'default',
sections : [childSection]
},
properties : {
itemId : 'row' + i,
accessoryType : Ti.UI.LIST_ACCESSORY_TYPE_NONE
}
});
}
// ListView section
var ParentSection = Ti.UI.createListSection({
items : data
});
// ListView
var parentListView = Ti.UI.createListView({
top : '8%',
bottom : '0%',
templates : {
default : templatemyParentHome
},
defaultItemTemplate : 'default',
sections : [ParentSection]
});
addtoHomeWindow.add(parentListView);
//Parent list template
function getHomeParentListTemplate() {
// ListView template
var templateCameraList = {
properties : {
height : '450dp'
},
childTemplates : [{
type : 'Ti.UI.Label',
bindId : 'site',
properties : {
font : {
fontWeight : 'bold',
fontSize : 20,
fontFamily : 'Arial'
},
color : '#000000',
top : '7%',
left : '5%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
bubbleParent : false
},
events : {
click : function(e) {
Ti.API.debug(e);
}
}
},{
type : 'Ti.UI.ImageView',
bindId : 'mainImage',
properties : {
top : '18%',
left : '5%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : '45%',
height : '60%',
bubbleParent : false
},
events : {
click : function(e) {
Ti.include("src/controller/EditLocationController.js");
var myloc_Controller = new EditLocationController();
myloc_Controller.showEditLocationScreen();
Ti.API.debug(e);
}
}
},
{
type : 'Ti.UI.Label',
bindId : 'mainCamera',
properties : {
font : {
fontSize : 20,
fontFamily : 'Arial'
},
color : '#000000',
top : '80%',
left : '20%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
bubbleParent : false,
text:'Main Camera'
}
},
{
type : 'Ti.UI.Label',
bindId : 'peakIn',
properties : {
font : {
fontSize : 20,
fontFamily : 'Arial'
},
color : nameSpaceConstantView.hyperlinkColor,
top : '88%',
left : '22%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
bubbleParent : false,
text:'Peak In'
},
events : {
click : function(e) {
Ti.API.debug(e);
}
}
},
{
type : 'Ti.UI.ListView',
bindId : 'listChild',
properties : {
top : '15%',
right :0,
horizontalAlign : 'center',
verticalAlign : 'center',
width : '45%',
height : '80%'
},
events : {
click : function(e) {
Ti.API.debug(e);
}
}
}]
};
return templateCameraList;
}
//Child List template
function getHomeChildListTemplate() {
// ListView template
var templateCameraList = {
properties : {
height : '450dp'
},
childTemplates : [{
type : 'Ti.UI.Label',
bindId : 'childsite',
properties : {
font : {
fontWeight : 'bold',
fontSize : 20,
fontFamily : 'Arial'
},
color : '#000000',
top : '7%',
left : '5%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
bubbleParent : false,
text : 'SiteName'
},
events : {
click : function(e) {
Ti.API.debug(e);
}
}
},
{
type : 'Ti.UI.ImageView',
bindId : 'childmainImage',
properties : {
top : '18%',
left : '5%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : '45%',
height : '60%',
bubbleParent : false
},
events : {
click : function(e) {
Ti.include("src/controller/EditLocationController.js");
var myloc_Controller = new EditLocationController();
myloc_Controller.showEditLocationScreen();
Ti.API.debug(e);
}
}
},
{
type : 'Ti.UI.Label',
bindId : 'childmainCamera',
properties : {
font : {
fontSize : 20,
fontFamily : 'Arial'
},
color : '#000000',
top : '80%',
left : '20%',
horizontalAlign : 'center',
verticalAlign : 'center',
width : Ti.UI.SIZE,
height : Ti.UI.SIZE,
bubbleParent : false,
text:'Main Camera'
}
}
// ,
// {
// type : 'Ti.UI.Label',
// bindId : 'childpeakIn',
// properties : {
// font : {
// fontSize : 20,
// fontFamily : 'Arial'
// },
// color : nameSpaceConstantView.hyperlinkColor,
// top : '88%',
// left : '22%',
// horizontalAlign : 'center',
// verticalAlign : 'center',
// width : Ti.UI.SIZE,
// height : Ti.UI.SIZE,
// bubbleParent : false,
// text:'Peak In'
// },
// events : {
// click : function(e) {
// Ti.API.debug(e);
// }
// }
// }
]
};
return templateCameraList;
}
↧