fix the testplan createtime problem

This commit is contained in:
fanfuxiaoran 2014-04-01 09:52:32 +08:00
parent d263a914b9
commit d38958ee0a
2 changed files with 22 additions and 8 deletions

View File

@ -25,24 +25,37 @@ function getColumn(obj, columnIndex) {
}
function extractRowData(data, tableModel, actionButton) {
var dataArray = new Array();
dataArray=getRowData(data, tableModel,dataArray);
dataArray = getRowData(data, tableModel, dataArray);
if (actionButton != null)
dataArray.push(actionButton);
return dataArray;
}
function extractRowDataActionBefore(data, tableModel, actionButton){
function extractRowDataActionBefore(data, tableModel, actionButton) {
var dataArray = new Array();
if (actionButton != null)
dataArray.push(actionButton);
dataArray=getRowData(data, tableModel,dataArray);
if (actionButton != null) {
}
dataArray.push(actionButton);
dataArray = getRowData(data, tableModel, dataArray);
return dataArray;
}
function getRowData(data, tableModel,dataArray){
function getRowData(data, tableModel, dataArray) {
for ( var i = 0; i < tableModel.length; i++) {
for ( var key in data) {
if (key == tableModel[i])
dataArray.push(data[key]);
if (key == tableModel[i]) {
dataArray.push(formatToData(key, data[key]));
}
}
}
return dataArray;
}
// this need to change
function formatToData(key, data) {
if (key.indexOf("DateTime") >= 0) {
var time = new Date(data);
time.setTime(data);
return time;
}
else return data;F
}

View File

@ -24,6 +24,7 @@ function loadTests(table, model,loadLength,actionButton) {
loadLength=data.list.length;
for ( var i = 0; i < loadLength; i++)
table.dataTable().fnAddData(
extractRowData(data.list[i], model, actionButton));
}