コミットメタ情報

リビジョン43e520ee9955ada0fab1a3ac31e3cb40b4f0a1d6 (tree)
日時2018-05-31 19:31:26
作者Kazuhiro Fujieda <fujieda@user...>
コミッターKazuhiro Fujieda

ログメッセージ

出撃統計をラベルのクリックで更新するとエラーになることがあるのを直す

変更サマリ

差分

--- a/LogViewer/tags.tag
+++ b/LogViewer/tags.tag
@@ -1280,28 +1280,18 @@ this.sortItemOrder = function(items) {
12801280 });
12811281 };
12821282
1283-this.setupTable = function(r) {
1283+this.setupColumns = function(r) {
12841284 for (var term in r) {
1285- var header = ["マップ",
1286- "出撃",
1287- "S",
1288- "A",
1289- "B",
1290- "C",
1291- "D以下",
1292- "輸送船"];
1293- var columns = [{ data: "map" },
1294- { data: "start" },
1295- { data: "S" },
1296- { data: "A" },
1297- { data: "B" },
1298- { data: "C" },
1299- { data: "D" },
1300- { data: "R" }];
1301- if (term === "month") {
1302- header.pop();
1285+ var columns = [{ data: "map", title: "マップ" },
1286+ { data: "start", title: "出撃" },
1287+ { data: "S", title: "S" },
1288+ { data: "A", title: "A" },
1289+ { data: "B", title: "B" },
1290+ { data: "C", title: "C" },
1291+ { data: "D", title: "D" },
1292+ { data: "R", title: "R" }];
1293+ if (term === "month")
13031294 columns.pop();
1304- }
13051295 var items = [];
13061296 for (var col in r[term].stat["合計"]) {
13071297 if (this.isItemColumn(col))
@@ -1309,16 +1299,8 @@ this.setupTable = function(r) {
13091299 }
13101300 this.sortItemOrder(items);
13111301 items.forEach(function(item) {
1312- header.push(item);
1313- columns.push({data: item});
1302+ columns.push({data: item, title: item});
13141303 });
1315- $("#sortie_stat_" + term).html(
1316- "<thead><tr>" +
1317- header.reduce(function(acc, cur) {
1318- return acc + "<th>" + cur + "</th>";
1319- }, "")
1320- + "</tr></thead>"
1321- );
13221304 r[term].columns = columns;
13231305 }
13241306 };
@@ -1373,20 +1355,24 @@ this.show = function(data) {
13731355 return;
13741356 }
13751357 var r = this.gatherData(data);
1376- this.setupTable(r);
1358+ this.setupColumns(r);
13771359 this.fillupItemRecords(r);
13781360 this.reorderRows(r);
13791361 for (var term in r) {
1380- if (!r.hasOwnProperty(term))
1381- continue;
13821362 var table = $("#sortie_stat_" + term);
1383- table.DataTable().destroy();
1363+ if ($.fn.dataTable.isDataTable(table))
1364+ table.DataTable().destroy();
1365+ table.html("<thead><tr>" +
1366+ r[term].columns.reduce(function(acc, cur) {
1367+ return acc + "<th>" + cur.title + "</th>";
1368+ }, "") + "</tr></thead>");
13841369 table.DataTable({
13851370 paging: false,
13861371 searching: false,
13871372 ordering: false,
1388- columns: r[term].columns
1389- }).rows.add(r[term].table).draw();
1373+ columns: r[term].columns,
1374+ data: r[term].table
1375+ });
13901376 }
13911377 $('#loading').hide();
13921378 };
旧リポジトリブラウザで表示