From e3b06f1ce4fadce32bba51acfd49aa3f8e24186b Mon Sep 17 00:00:00 2001 From: Jason Skomorowski Date: Mon, 25 Aug 2014 14:07:37 -0400 Subject: [PATCH] Almost using init() for details except $.append() doesn't. --- src/mkws-team.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mkws-team.js b/src/mkws-team.js index ead2f03..d6af521 100644 --- a/src/mkws-team.js +++ b/src/mkws-team.js @@ -151,15 +151,6 @@ function team($, teamName) { // FIXME: record is async!! clearTimeout(m_paz.recordTimer); queue("record").publish(data); - var detRecordDiv = findnode(recordDetailsId(data.recid[0])); - if (detRecordDiv.length) { - // in case on_show was faster to redraw element - return; - } - m_currentRecordData = data; - var recordDiv = findnode('.' + recordElementId(m_currentRecordData.recid[0])); - var html = renderDetails(m_currentRecordData); - $(recordDiv).append(html); } @@ -345,7 +336,7 @@ function team($, teamName) { m_currentRecordId = recId; // remove current detailed view if any - findnode('#' + recordDetailsId(oldRecordId)).remove(); + findnode('.mkwsDetails').remove(); // if the same clicked, just hide if (recId == oldRecordId) { @@ -353,9 +344,19 @@ function team($, teamName) { m_currentRecordData = null; return; } - // request the record - log("showDetails() requesting record '" + recId + "'"); - m_paz.record(recId); + + var detRecordDiv = findnode(recordDetailsId(recId)); + if (detRecordDiv.length) { + // in case on_show was faster to redraw element + return; + } + var recordDiv = findnode('.' + recordElementId(recId)); + var html = '