ajax请求list集合数据结合插件jquery.treetable展示数据

    xiaoxiao2022-07-02  93

    ajax请求两个list集合数据

    window.onload=function() { $.ajax({ async:false, url:"../showProjectAging.do", type:"post", dataType:"json", success:function(data){ for(var i=0;i<data.length;i++){ var str = ""; var strer = ""; var id = data[i].project_id; var name = data[i].project_name; var abb = data[i].project_abbreviation; var stage = data[i].project_stage; var user = data[i].user.user_username; var list = data[i].agingList; str += "<tr data-tt-id='" + ++i + "'>" + "<td>" + name + "</td>" + "<td>" + abb + "</td>" + "<td>" + stage + "</td>" + "<td>" + user + "</td>" + "<td><span>删除</span></td>" + "</tr>"; for( var j=0;j<$(list).length;j++){ var idwer = $(list)[j].project_id; var ider = $(list)[j].aging_id; var nameer = $(list)[j].aging_name; var abber= $(list)[j].aging_abbreviation; var stageer = $(list)[j].aging_stage; strer += "<tr data-tt-id='" + i + "-" + ++j + "' data-tt-parent-id='" + i + "'>" + "<td>" + nameer + "</td>" + "<td>" + abber + "</td>" + "<td>" + stageer + "</td>" + "<td>xx</td>" + "<td><span>删除</span></td>" + "</tr>"; --j; } --i; $("#example-advanced").append(str+strer); initTreeTable(); } }, error:function(data){ alert("未成功"); } }); }; function initTreeTable() { $("#example-advanced").treetable({ expandable : true }); });

    ps:一起交流下~

    最新回复(0)