情况:
我有一个列出一堆人的 UL 我在顶部有两个按钮“All”和“Common”
在加载时,您会看到所有人。然后,您可以单击 Common 按钮,UL 将被过滤到仅某些人。
这工作正常。但是在每个 LI 中,我有 2 个复选框 - 当我在“所有”类别中选中它们,然后选择“最近”选项卡以检查其他人,然后我返回“所有”选项卡时,有时我会丢失复选框状态。
应该注意的是,这是使用 phonegap 开发的
function getFriends(common)
{
if(common=="common")
{
//Hide everyone to start with
$("#PersonSelection li").hide();
//ajax query that loops through the common players goes here
$('#'+item.PlayerId).show(); //this is the id of each li that is common, so after I hide all I just show those that are common
//end ajax loop
} else {
if ($("#PersonSelection li").size() > 1) //this is there for when we go from common back to all I don't have to go back to the DB
{
$("#PersonSelection li").show();
}
else
{
//go back to ajax query that loops a variable with li and checkbox info and the appends
document.getElementById('PersonSelection').innerHTML += people;
}
}