0

状況:

たくさんの人をリストする UL があります。上部に「すべて」と「共通」の 2 つのボタンがあります。

ロードすると、すべての人が表示されます。次に [共通] ボタンをクリックすると、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;
    }
}
4

1 に答える 1

0

さて、私はそれを理解しました-私はかなりうまくデバッグしたと思いましたが、それはこの document.getElementById('PersonSelection').innerHTML += people; の問題でした。

于 2013-04-11T22:05:44.003 に答える