Removal of old full-record div now honours teamname.
[mkws-moved-to-github.git] / src / mkws-team.js
index 6b2c081..8a78520 100644 (file)
@@ -255,7 +255,7 @@ function team($, teamName) {
     that.resetPage = resetPage;
 
 
-    function newSearch(query, sortOrder, targets)
+    function newSearch(query, sortOrder, perpage, targets)
     {
        log("newSearch: " + query);
 
@@ -265,14 +265,14 @@ function team($, teamName) {
        }
 
        m_filters = []
-       triggerSearch(query, sortOrder, targets);
+       triggerSearch(query, sortOrder, perpage, targets);
        switchView('records'); // In case it's configured to start off as hidden
        m_submitted = true;
     }
     that.newSearch = newSearch;
 
 
-    function triggerSearch(query, sortOrder, targets)
+    function triggerSearch(query, sortOrder, perpage, targets)
     {
        resetPage();
        queue("navi").publish();
@@ -287,6 +287,9 @@ function team($, teamName) {
        if (sortOrder) {
            m_sortOrder = sortOrder;
        }
+       if (perpage) {
+           m_perpage = perpage;
+       }
        if (targets) {
            m_filters.push({ id: targets, name: targets });
        }
@@ -363,11 +366,7 @@ function team($, teamName) {
        m_currentRecordId = recId;
 
        // remove current detailed view if any
-       // ##### restrict to current team
-       var detRecordDiv = document.getElementById(recordDetailsId(oldRecordId));
-       // lovin DOM!
-       if (detRecordDiv)
-           detRecordDiv.parentNode.removeChild(detRecordDiv);
+       findnode('#' + recordDetailsId(oldRecordId)).remove();
 
        // if the same clicked, just hide
        if (recId == oldRecordId) {