my-tree.js 862 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. var checkedIds = [];
  2. var checkedNoteName = [];
  3. function getNodes() {
  4. var nodes = $("#itemTree").getTSNs(true);//获取所有勾选节点包括半勾选
  5. $.each(nodes, function (i, value) {
  6. var id = value.id;
  7. checkedIds.push(id);
  8. });
  9. }
  10. //被选中元素的ID,TEXT 数组维护
  11. function GetAllCheckNodes(id, status, text) {
  12. //数据加入数组
  13. if (status == 1) {
  14. if (!checkedIds.contain(id)) {
  15. checkedIds.push(id);
  16. }
  17. if (!checkedNoteName.contain(text)) {
  18. checkedNoteName.push(text);
  19. }
  20. }
  21. if (status == 0) {
  22. if (checkedIds.contain(id)) {
  23. checkedIds.splice(checkedIds.indexOf(id), 1);
  24. }
  25. if (checkedNoteName.contain(text)) {
  26. checkedNoteName.splice(checkedNoteName.indexOf(text), 1);
  27. }
  28. }
  29. }