hello. I have created a dynamic list view as below. I used ui-listview here.
var homeListView = document.getElementById("home-list-view");
var tauHomeListView = tau.widget.Listview(homeListView);
homeListView.innerHTML = null;
// element 1
var balanceLi = document.createElement("li");
var balanceDiv = document.createElement("div");
var balanceIcon = document.createElement("img");
balanceIcon.src = "/assets/images/icon_balance.png";
var balanceText = document.createElement("h4");
balanceText.innerHTML = "Balance";
balanceDiv.appendChild(balanceIcon);
balanceDiv.appendChild(balanceText);
balanceLi.appendChild(balanceDiv);
balanceDiv.addEventListener('click', function() {
navigateFromHome("balance");
});
tauHomeListView.addItem(balanceLi.innerHTML,1);
// element 2
var smsLi = document.createElement("li");
var smsDiv = document.createElement("div");
var smsIcon = document.createElement("img");
smsIcon.src = "/assets/images/icon_sms.png";
var smsText = document.createElement("h4");
smsText.innerHTML = "SMS";
smsDiv.appendChild(smsIcon);
smsDiv.appendChild(smsText);
smsLi.appendChild(smsDiv);
smsLi.addEventListener('click', function() {
navigateFromHome("sms");
});
tauHomeListView.addItem(smsLi.innerHTML,2);
The items are rendered as I expected. but unfortunately, the click event added to li components not triggering. I added those to inside div elements. nothing happens. hope you support this. Thanks!