-1
如何爲可觀察數組創建的列表創建按字母順序排列的分隔符?我希望名單被姓氏除。它已經排序,它只需要分頻器。動態字母分隔符
在這裏創建的列表:
function GetUsersByLocation(){
var url = 'http://localhost/Service.svc/GetUsersByLocation/'+localStorage.CurrentLocationId;
var jqxhr =
$.getJSON(url,
function (data)
{
userViewModel.clearUsers();
$.each(data.GetUsersByLocationResult, function (key, val) {
userViewModel.addUser(val.FirstName, val.LastName);
});
ko.applyBindings(userViewModel, document.getElementById("usersListView"));
})
.success(function() { $('#usersListView').listview('refresh'); })
}
在這裏實現:
<div>
<ul id="usersListView" data-bind="template: {name: 'usersListTemplate', foreach: users}" data-role="listview" data-filter="false" data-filter-placeholder="enter a colleague's name..."></ul>
</div>
<script id="usersListTemplate" type="text/html">
<li><a href="javascript: void(0)">
<table>
<tr class="colleague">
<td>
<table>
<tr><td><span class="firstname_" data-bind="text: firstname"></span> <span data-bind="text: lastname"></span></td></tr>
</table></a>
</td>
</tr>
</table>
</li>
</script>
聽起來有點像你的[其他問題](http://stackoverflow.com/questions/13404876/autodividers-for-list)... – Jack