X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widgets.js;h=19f10661e919f741389558340d73feb96032052b;hb=c459c34be1df2a53cb7881ec5f22b65ddd2956f2;hp=22b98209187f394f13032119d2af607e6f9ebfa7;hpb=eeacdfe977f8180e0ad19d00996c6c95b68e5c3b;p=mkws-moved-to-github.git diff --git a/src/mkws-widgets.js b/src/mkws-widgets.js index 22b9820..19f1066 100644 --- a/src/mkws-widgets.js +++ b/src/mkws-widgets.js @@ -22,6 +22,10 @@ function widget($, team, type, node) { return '[Widget ' + team.name() + ':' + type + ']'; }; + that.value = function() { + return node.value; + } + for (var i = 0; i < node.attributes.length; i++) { var a = node.attributes[i]; if (a.name === 'data-mkws-config') { @@ -181,24 +185,24 @@ mkws.registerWidgetType('Pager', function() { ? firstClkbl + 2*onsides : pages; - var prev = '<< ' + M('Prev') + ' | '; + var prev = '<< ' + M('Prev') + ' | '; if (currentPage > 1) prev = '' - +'<< ' + M('Prev') + ' | '; + +'<< ' + M('Prev') + ' | '; var middle = ''; for(var i = firstClkbl; i <= lastClkbl; i++) { var numLabel = i; if(i == currentPage) - numLabel = '' + i + ''; + numLabel = '' + i + ''; middle += ' ' + numLabel + ' '; } - var next = ' | ' + M('Next') + ' >>'; + var next = ' | ' + M('Next') + ' >>'; if (pages - currentPage > 0) - next = ' | ' + next = ' | ' + M('Next') + ' >>'; var predots = ''; @@ -218,6 +222,13 @@ mkws.registerWidgetType('Pager', function() { }); +mkws.registerWidgetType('Results', function() { + // Nothing to do apart from act as an autosearch trigger + // Contained elements do all the real work + widget.autosearch(this); +}); + + mkws.registerWidgetType('Records', function() { var that = this; var team = this.team; @@ -288,7 +299,6 @@ mkws.registerWidgetType('Sort', function() { $(this.node).change(function() { that.team.set_sortOrder($(that.node).val()); if (that.team.submitted()) { - that.team.resetPage(); that.team.reShow(); } return false; @@ -302,9 +312,17 @@ mkws.registerWidgetType('Perpage', function() { $(this.node).change(function() { that.team.set_perpage($(that.node).val()); if (that.team.submitted()) { - that.team.resetPage(); that.team.reShow(); } return false; }); }); + + +mkws.registerWidgetType('Done', function() { + var that = this; + + this.team.queue("complete").subscribe(function(n) { + $(that.node).html("Search complete: found " + n + " records"); + }); +});