直接上代码: $(document).ready(function() {
$.ajax({
cache: false,
url: 'data.xml',
dataType: 'xml',
type: 'GET',
timeout: 1000,
error: function(xml) {
alert("加载数据文件失败...");
},
success: function(xml) {
var g = new Gantt(document.getElementById("GanttChart"));
$(xml).find("taskList").each(function(i) { var _Id = $(this).children("id");
var _from = $(this).children("from");
var _to = $(this).children("to");
var _topra = $(this).children("topra");
var _task = $(this).children("task");
var _resource = $(this).children("resource");
var _progress = $(this).children("progress");
var _notes = $(this).children("notes");
var _noworkday = $(this).children("noworkday");
//获取id节点的文本值;
var id = _Id.text();
var from = _from.text();
var to = _to.text();
var topra = _topra.text();
var task = _task.text();
var resource = _resource.text();
var progress = _progress.text();
var notes = _notes.text();
var noworkday = _noworkday.text(); g.AddTaskDetail(new Task(from, to,topra,task, resource, progress, notes,noworkday)); })
g.Draw();
}
});现在是读取的xml文件的数据,怎样直接从数据库中读取啊,还得循环把值赋给这个方法...
$.ajax({
cache: false,
url: 'data.xml',
dataType: 'xml',
type: 'GET',
timeout: 1000,
error: function(xml) {
alert("加载数据文件失败...");
},
success: function(xml) {
var g = new Gantt(document.getElementById("GanttChart"));
$(xml).find("taskList").each(function(i) { var _Id = $(this).children("id");
var _from = $(this).children("from");
var _to = $(this).children("to");
var _topra = $(this).children("topra");
var _task = $(this).children("task");
var _resource = $(this).children("resource");
var _progress = $(this).children("progress");
var _notes = $(this).children("notes");
var _noworkday = $(this).children("noworkday");
//获取id节点的文本值;
var id = _Id.text();
var from = _from.text();
var to = _to.text();
var topra = _topra.text();
var task = _task.text();
var resource = _resource.text();
var progress = _progress.text();
var notes = _notes.text();
var noworkday = _noworkday.text(); g.AddTaskDetail(new Task(from, to,topra,task, resource, progress, notes,noworkday)); })
g.Draw();
}
});现在是读取的xml文件的数据,怎样直接从数据库中读取啊,还得循环把值赋给这个方法...
解决方案 »
- 非常棘手的一个treeview绑定问题,望高手指教!
- 正则表达式中的全角半角问题
- 写xml文件
- 求助GridView控件和TreeView控件两个问题(解决了包括这个贴还有另外几个贴的一共120分一并相送)
- 安装SQL2000时候到注册 注册表了出现问题帮忙3Q
- 大家帮我看看这到底是怎么回事,怎么老是提示'必须输入参数@title',可是已经有了呀
- Web.config配置错误
- 电脑重启后,ASP.net无法调试.
- 谁有用XmlReader读取、显示.xml文件的实例???????????
- 求救,在线等待!!!
- 出现错误后好像是自动产生了个文件夹,里面有个叫CodeAnalysisLog.xml的文件
- 高手请进
或者用Extjs