jquery的treetable能刷新吗
比如我添加了一个数据到treetable,想点击保存后刷新treetable显示新的数据,怎么实现?...
比如我添加了一个数据到treetable,想点击保存后刷新treetable显示新的数据,怎么实现?
展开
1个回答
展开全部
添加的数据存储到服务器 刷新时重新从服务器读取数据
tree=new dhtmlXTreeObject(document.getElementById('tree_box'),"100%","100%",-1);
tree.setImagePath("../js/plug-in/dhtmlTree/imgs/csh_vista/");
//tree.setOnRightClickHandler(viewRight);
tree.attachEvent("onClick",treeClick);
function refresh_tree(){ //刷新目录树
tree.insertNewChild("-1","0","全部");
$.ajax({
type: "get",//使用get方法访问后台
dataType: "json",//返回json格式的数据
url: "../jsonfile/depart_json.php",//要访问的后台地址
async:true,
success: function(msg){//msg为返回的数据,在这里做数据绑定
var arr=msg;
$.each(arr,function(idx,item){
tree.insertNewChild(item.upper_depart_id,item.depart_id,item.Depart_name);
});
}
});
tree.setItemColor(0,"#ff0000","#fffff");
tree.setItemColor(998,"#ff0000","#fffff");
tree.setItemColor(999,"#ff0000","#fffff");
tree.setItemColor(999,"#ff0000","#fffff");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询