Generate target filters first, then keyword filters separately.
[mkws-moved-to-github.git] / src / mkws-widgets.js
index 9f6c418..c04c3f9 100644 (file)
@@ -222,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;
@@ -260,18 +267,23 @@ mkws.registerWidgetType('Navi', function() {
     var M = mkws.M;
 
     this.team.queue("navi").subscribe(function() {
+       // This is very low-level poking around inside the filter structure
        var filters = that.team.filters();
        var text = "";
 
        for (var i in filters) {
-           if (text) {
-               text += " | ";
-           }
            var filter = filters[i];
            if (filter.id) {
+               if (text) text += " | ";
                text += M('source') + ': <a class="crossout" href="#" onclick="mkws.delimitTarget(\'' + teamName +
                    "', '" + filter.id + "'" + ');return false;">' + filter.name + '</a>';
-           } else {
+           }
+       }
+
+       for (var i in filters) {
+           var filter = filters[i];
+           if (!filter.id) {
+               if (text) text += " | ";
                text += M(filter.field) + ': <a class="crossout" href="#" onclick="mkws.delimitQuery(\'' + teamName +
                    "', '" + filter.field + "', '" + filter.value + "'" +
                    ');return false;">' + filter.value + '</a>';