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) { function extractRowData(data, tableModel, actionButton) {
var dataArray = new Array(); var dataArray = new Array();
dataArray=getRowData(data, tableModel,dataArray); dataArray = getRowData(data, tableModel, dataArray);
if (actionButton != null) if (actionButton != null)
dataArray.push(actionButton); dataArray.push(actionButton);
return dataArray; return dataArray;
} }
function extractRowDataActionBefore(data, tableModel, actionButton){ function extractRowDataActionBefore(data, tableModel, actionButton) {
var dataArray = new Array(); var dataArray = new Array();
if (actionButton != null) if (actionButton != null) {
dataArray.push(actionButton); }
dataArray=getRowData(data, tableModel,dataArray); dataArray.push(actionButton);
dataArray = getRowData(data, tableModel, dataArray);
return dataArray; return dataArray;
} }
function getRowData(data, tableModel,dataArray){ function getRowData(data, tableModel, dataArray) {
for ( var i = 0; i < tableModel.length; i++) { for ( var i = 0; i < tableModel.length; i++) {
for ( var key in data) { for ( var key in data) {
if (key == tableModel[i]) if (key == tableModel[i]) {
dataArray.push(data[key]); dataArray.push(formatToData(key, data[key]));
}
} }
} }
return dataArray; 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; loadLength=data.list.length;
for ( var i = 0; i < loadLength; i++) for ( var i = 0; i < loadLength; i++)
table.dataTable().fnAddData( table.dataTable().fnAddData(
extractRowData(data.list[i], model, actionButton)); extractRowData(data.list[i], model, actionButton));
} }