6519dbcfee2bda13241884aad2b94fae7c0242b9.svn-base 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. //将选中的行存入数组,并用isChecked方法在分页时进行选中项重置
  2. function findCheckedArray2(id)
  3. {
  4. for(var i =0;i<checkedArray2.length;i++)
  5. {
  6. if(checkedArray2[i] == id) return i;
  7. }
  8. return -1;
  9. }
  10. function addCheckedArray2(id,name)
  11. {
  12. if(findCheckedArray2(id) == -1){
  13. checkedArray2.push(id);
  14. checkedTextArray2.push(name);
  15. }
  16. }
  17. function removeCheckedArray2(id)
  18. {
  19. var i = findCheckedArray2(id);
  20. if(i==-1) return;
  21. checkedArray2.splice(i,1);
  22. checkedTextArray2.splice(i,1);
  23. }
  24. function checkedHandler2(rowdata)
  25. {
  26. if (findCheckedArray2(rowdata.userId) == -1)
  27. return false;
  28. return true;
  29. }
  30. function checkRowHandler2(checked, data)
  31. {
  32. if (checked) addCheckedArray2(data.userId,data.userName);
  33. else removeCheckedArray2(data.userId,data.userName);
  34. }
  35. function checkAllRowHandler2(checked)
  36. {
  37. for (var rowid in this.records)
  38. {
  39. if(checked)
  40. addCheckedArray2(this.records[rowid]['userId'],this.records[rowid]['userName']);
  41. else
  42. removeCheckedArray2(this.records[rowid]['userId'],this.records[rowid]['userName']);
  43. }
  44. }