Termlists: promoteTermlists,
Pager: promotePager,
Records: promoteRecords,
- Navi: promoteNavi
+ Navi: promoteNavi,
+ Sort: promoteSort,
+ Perpage: promotePerpage
};
var promote = type2fn[type];
$(node).html(text);
});
}
+
+
+ function promoteSort() {
+ team.queue("navi").subscribe(function() {})
+ $(node).change(onSortChange);
+
+ function onSortChange()
+ {
+ team.set_sortOrder($(node).val());
+ if (!team.submitted()) return false;
+ team.resetPage();
+ team.reShow();
+ return false;
+ }
+ }
+
+
+ function promotePerpage() {
+ team.queue("navi").subscribe(function() {})
+ $(node).change(onPerpageChange);
+
+ function onPerpageChange()
+ {
+ team.set_perpage($(node).val());
+ if (!team.submitted()) return false;
+ team.resetPage();
+ team.reShow();
+ return false;
+ }
+ }
}
var m_template = {};
that.name = function() { return m_teamName; }
+ that.submitted = function() { return m_submitted; }
that.perpage = function() { return m_perpage; }
that.totalRecordCount = function() { return m_totalRecordCount; }
that.currentPage = function() { return m_currentPage; }
that.currentRecordData = function() { return m_currentRecordData; }
that.filters = function() { return m_filters; }
+ that.set_sortOrder = function(val) { m_sortOrder = val };
+ that.set_perpage = function(val) { m_perpage = val };
+
+
var debug = function (s) {
var now = $.now();
var timestamp = ((now - m_debugTime.start)/1000).toFixed(3) + " (+" + ((now - m_debugTime.last)/1000).toFixed(3) + ") "
}
- function onSortChange()
- {
- m_sortOrder = findnode('.mkwsSort').val();
- if (!m_submitted) return false;
- resetPage();
- m_paz.show(0, m_perpage, m_sortOrder);
- return false;
- }
-
-
- function onPerpageChange()
- {
- m_perpage = findnode('.mkwsPerpage').val();
- if (!m_submitted) return false;
- resetPage();
- m_paz.show(0, m_perpage, m_sortOrder);
- return false;
- }
-
-
// limit by target functions
that.limitTarget = function (id, name)
{
m_currentPage = 1;
m_totalRecordCount = 0;
}
+ that.resetPage = resetPage;
function triggerSearch (query, sortOrder, targets)
}
+ that.reShow = function() {
+ m_paz.show(0, m_perpage, m_sortOrder);
+ }
+
+
+
that.showPage = function (pageNum)
{
m_currentPage = pageNum;
mkwsHtmlSwitch();
findnode('.mkwsSearchForm').submit(onFormSubmitEventHandler);
- findnode('.mkwsSort').change(onSortChange);
- findnode('.mkwsPerpage').change(onPerpageChange);
// on first page, hide the termlist
$(document).ready(function() { findnode(".mkwsTermlists").hide(); });