From d38958ee0ae94352cbeff0480c12044a501209bd Mon Sep 17 00:00:00 2001 From: fanfuxiaoran <495538672@qq.com> Date: Tue, 1 Apr 2014 09:52:32 +0800 Subject: [PATCH] fix the testplan createtime problem --- .../src/main/webapp/script/bench4q.table.js | 29 ++++++++++++++----- .../src/main/webapp/script/loadTestPlans.js | 1 + 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Bench4Q-Web/src/main/webapp/script/bench4q.table.js b/Bench4Q-Web/src/main/webapp/script/bench4q.table.js index 65503a8c..64140e7e 100644 --- a/Bench4Q-Web/src/main/webapp/script/bench4q.table.js +++ b/Bench4Q-Web/src/main/webapp/script/bench4q.table.js @@ -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 } \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/loadTestPlans.js b/Bench4Q-Web/src/main/webapp/script/loadTestPlans.js index 8acb6a0d..57902f52 100644 --- a/Bench4Q-Web/src/main/webapp/script/loadTestPlans.js +++ b/Bench4Q-Web/src/main/webapp/script/loadTestPlans.js @@ -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)); }