moksha/public/javascript/moksha.js | 9 +++---
moksha/public/javascript/ui/moksha.ui.grid.js | 34 ++++++++++++++++++++++++--
2 files changed, 37 insertions(+), 6 deletions(-)
New commits:
commit ad42a78f5dc95009e8e8589eb2ed7135c815b227
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon May 4 17:20:31 2009 -0400
remove debugging alert statement
diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js
index 4a349a0..077379a 100644
--- a/moksha/public/javascript/ui/moksha.ui.grid.js
+++ b/moksha/public/javascript/ui/moksha.ui.grid.js
@@ -536,7 +536,6 @@
// set the defaults
$.each(filters, function (i, f) {
- alert (f.name + '=' + f.value);
o.filters[f.name] = f.value;
});
},
commit 6c411fdd19d9bfae7e7e3a606a93db247193b3c3
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon May 4 17:20:16 2009 -0400
fix selector
diff --git a/moksha/public/javascript/moksha.js b/moksha/public/javascript/moksha.js
index 3e045bd..e381146 100644
--- a/moksha/public/javascript/moksha.js
+++ b/moksha/public/javascript/moksha.js
@@ -147,9 +147,8 @@ moksha = {
// run over all the toplevel arguments and add them to the list
// if they match
var $filtered_fragment = fragment.filter('a[moksha_url]');
- $a_list.extend($filtered_fragment);
- if (!$a_list.length)
+ if (!($a_list.length + $filtered_fragment.length))
return fragment;
var _goto = function(e) {
@@ -159,7 +158,7 @@ moksha = {
return false;
}
- $.each($a_list, function(i, e) {
+ var transform = function(i, e) {
var $e = $(e)
var href = $e.attr('href');
var moksha_url = $e.attr('moksha_url');
@@ -172,7 +171,9 @@ moksha = {
href = moksha.url(href);
e.href = href;
}
- );
+
+ $.each($a_list, transform);
+ $.each($filtered_fragment, transform);
return fragment;
},
commit 68113281b3a4344b7fc6e48b389d929220edff69
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Mon May 4 17:05:06 2009 -0400
add a filter plugin to the grid
diff --git a/moksha/public/javascript/ui/moksha.ui.grid.js b/moksha/public/javascript/ui/moksha.ui.grid.js
index cdd4240..4a349a0 100644
--- a/moksha/public/javascript/ui/moksha.ui.grid.js
+++ b/moksha/public/javascript/ui/moksha.ui.grid.js
@@ -36,6 +36,8 @@
self.$rowplaceholder = jQuery('<span />').addClass('moksha_rowplaceholder');
self.$rowplaceholder.hide();
+ self._init_controls();
+
if (!self.element.is('table')) {
var t = self._generate_table();
@@ -44,8 +46,6 @@
self._setup_template();
}
- self._init_controls();
-
self.clear();
},
@@ -521,6 +521,37 @@
}
});
+ $.ui.mokshagrid.prototype.controls.filter = {
+ _init: function($grid, $el) {
+ var filters = this.getFilters($el);
+ var self = this;
+ var o = $grid.options;
+
+ var onChange = function() {
+ o.filters[this.name] = this.value;
+ $grid.request_data_refresh();
+ }
+
+ filters.change(onChange);
+
+ // set the defaults
+ $.each(filters, function (i, f) {
+ alert (f.name + '=' + f.value);
+ o.filters[f.name] = f.value;
+ });
+ },
+
+ getFilters: function($el) {
+ var filters = $el.find('select,input');
+
+ return filters;
+ },
+
+ processElement: function($el) {
+ // we don't do anything here as it is all handled by the event handler
+ },
+ }
+
$.ui.mokshagrid.prototype.controls.info_display = {
_init: function($grid, $el) {
var template_html = '<span>' + unescape($el.html()) + '<span>';