huimv.tree.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * 基于jQuery下拉树形插件 $Author:hongjun.hu $Date: 2014-04-30
  3. */
  4. (function($) {
  5. $.fn.hmtree = function(settings) {
  6. // 默认参数
  7. var p = {
  8. height : "auto",
  9. mustSelect : false,
  10. showcheck : false
  11. };
  12. $.extend(p, settings);
  13. var l = $(this);
  14. processAjaxTree();
  15. function processAjaxTree() {
  16. var treedata = [];
  17. $.ajaxSetup({
  18. cache : false
  19. });
  20. $.ajax({
  21. url : "getTreeData.htm",
  22. data : {
  23. "lx" : p.lx
  24. },
  25. method : "post",
  26. dataType : "json",
  27. success : function(result) {
  28. for (var i = 0; i < result.length; i++) {
  29. treedata.push(result[i]);
  30. }
  31. $(l).treebuild({
  32. url : "getTreeData.htm",
  33. data : treedata,
  34. showcheck : false,
  35. onnodeclick : function(item) {
  36. var hrefStr = p.hrefURL;
  37. if (p.lx == "行政区划") {
  38. hrefStr += "?qhbm=" + item.value + "&qhlx=" + item.qhlx;
  39. }
  40. huimv.loadPage("xzqhRight", hrefStr);
  41. },
  42. asnyParam : [{
  43. name : "lx",
  44. value : p.lx
  45. }]
  46. });
  47. }
  48. });
  49. }
  50. return l;
  51. };
  52. })(jQuery);