Save displayName of authenticated library, if any, as mkws.authName.
[mkws-moved-to-github.git] / src / mkws-widgets.js
index 4bf7ec7..b286705 100644 (file)
@@ -271,15 +271,17 @@ function promoteToNavi() {
 mkws.registerWidgetType('Navi', promoteToNavi);
 
 
+// It seems this and the Perpage widget doen't need to subscribe to
+// anything, since they produce events rather than consuming them.
+//
 function promoteToSort() {
-    // It seems this and the Perpage widget doen't need to
-    // subscribe to anything, since they produce events rather
-    // than consuming them.
+    var that = this;
+
     $(this.node).change(function () {
-       this.team.set_sortOrder($(node).val());
-       if (this.team.submitted()) {
-           this.team.resetPage();
-           this.team.reShow();
+       that.team.set_sortOrder($(that.node).val());
+       if (that.team.submitted()) {
+           that.team.resetPage();
+           that.team.reShow();
        }
        return false;
     });
@@ -287,14 +289,15 @@ function promoteToSort() {
 mkws.registerWidgetType('Sort', promoteToSort);
 
 
-function promoteToPerpage() {
+mkws.registerWidgetType('Perpage', function() {
+    var that = this;
+
     $(this.node).change(function() {
-       this.team.set_perpage($(node).val());
-       if (this.team.submitted()) {
-           this.team.resetPage();
-           this.team.reShow();
+       that.team.set_perpage($(that.node).val());
+       if (that.team.submitted()) {
+           that.team.resetPage();
+           that.team.reShow();
        }
        return false;
     });
-}
-mkws.registerWidgetType('Perpage', promoteToPerpage);
+});