<div id="menu">
<ul class="ui-body-e" id="clientsList" data-filter="true" data-inset="true" data-role="listview" >
<li id="entryTemplate" class="entry" style="display:none">
<a href="#cliMaLi" data-transition="slide">
<span class="fnameLabel">Label</span> <span class="snameLabel">Label</span></a>
</li>
</ul>
</div>
// Generate client list
function refreshCliLi () {
$('#menu ul li:gt(0)').remove();
JLEGALDB.transaction (
function(transaction){
transaction.executeSql('SELECT id, fname, sname FROM clients;', undefined, function(transaction, result){
for(var i = 0; i < result.rows.length; i++){
var row = result.rows.item(i);
var newEntryRow = $('#entryTemplate').clone();
newEntryRow.removeAttr('style');
newEntryRow.data('entryId', row.id);
newEntryRow.appendTo('#menu ul');
newEntryRow.find('.snameLabel').text(row.sname);
newEntryRow.find('.fnameLabel').text(row.fname);
}
}, errorHandler);
});
}
客户列表中的项目是从数据库中生成的。在客户列表中选择客户名称时,如何获取该选择的文本???