- Add event paramenter

- Implement Paging control
This commit is contained in:
YNH Webdev
2013-09-14 14:27:11 +02:00
parent 09544ba6d2
commit 95f823e7a1
17 changed files with 336 additions and 63 deletions

View File

@@ -1,6 +1,6 @@
// Generated by CoffeeScript 1.6.1
(function() {
var $el, Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_REGEXP_VALIDATOR, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, cache, controls, name, state, template, tmpl, trigger_callback, type, typemap, validatormap, _ref, _ref1, _ref2,
var $el, Mini, WSF_AUTOCOMPLETE_CONTROL, WSF_BUTTON_CONTROL, WSF_CHECKBOX_CONTROL, WSF_CHECKBOX_LIST_CONTROL, WSF_CONTROL, WSF_FORM_ELEMENT_CONTROL, WSF_GRID_CONTROL, WSF_HTML_CONTROL, WSF_INPUT_CONTROL, WSF_MAX_VALIDATOR, WSF_MIN_VALIDATOR, WSF_PAGINATION_CONTROL, WSF_REGEXP_VALIDATOR, WSF_TEXTAREA_CONTROL, WSF_VALIDATOR, cache, controls, name, state, template, tmpl, trigger_callback, type, typemap, validatormap, _ref, _ref1, _ref2,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
@@ -24,11 +24,12 @@
}
};
trigger_callback = function(control_name, event) {
trigger_callback = function(control_name, event, event_parameter) {
return $.ajax({
data: {
control_name: control_name,
event: event,
event_parameter: event_parameter,
states: JSON.stringify(window.states)
},
cache: false
@@ -463,6 +464,71 @@
})(WSF_CONTROL);
WSF_PAGINATION_CONTROL = (function(_super) {
__extends(WSF_PAGINATION_CONTROL, _super);
function WSF_PAGINATION_CONTROL() {
return WSF_PAGINATION_CONTROL.__super__.constructor.apply(this, arguments);
}
WSF_PAGINATION_CONTROL.prototype.attach_events = function() {
var self;
self = this;
return this.$el.on('click', 'a', function(e) {
e.preventDefault();
return self.click(e);
});
};
WSF_PAGINATION_CONTROL.prototype.click = function(e) {
var nr;
nr = $(e.target).data('nr');
if (nr === "next") {
return trigger_callback(this.control_name, "next");
} else if (nr === "prev") {
return trigger_callback(this.control_name, "prev");
} else {
return trigger_callback(this.control_name, "goto", nr);
}
};
WSF_PAGINATION_CONTROL.prototype.update = function(state) {
if (state._html != null) {
return this.$el.html($(state._html).html());
}
};
return WSF_PAGINATION_CONTROL;
})(WSF_CONTROL);
WSF_GRID_CONTROL = (function(_super) {
__extends(WSF_GRID_CONTROL, _super);
function WSF_GRID_CONTROL() {
return WSF_GRID_CONTROL.__super__.constructor.apply(this, arguments);
}
WSF_GRID_CONTROL.prototype.attach_events = function() {
var self;
return self = this;
};
WSF_GRID_CONTROL.prototype.update = function(state) {
if (state.datasource != null) {
window.states[this.control_name]['datasource'] = state.datasource;
}
if (state._body != null) {
return this.$el.find('tbody').html($(state._body).html());
}
};
return WSF_GRID_CONTROL;
})(WSF_CONTROL);
typemap = {
"WSF_BUTTON_CONTROL": WSF_BUTTON_CONTROL,
"WSF_INPUT_CONTROL": WSF_INPUT_CONTROL,
@@ -471,7 +537,9 @@
"WSF_CHECKBOX_CONTROL": WSF_CHECKBOX_CONTROL,
"WSF_FORM_ELEMENT_CONTROL": WSF_FORM_ELEMENT_CONTROL,
"WSF_HTML_CONTROL": WSF_HTML_CONTROL,
"WSF_CHECKBOX_LIST_CONTROL": WSF_CHECKBOX_LIST_CONTROL
"WSF_CHECKBOX_LIST_CONTROL": WSF_CHECKBOX_LIST_CONTROL,
"WSF_PAGINATION_CONTROL": WSF_PAGINATION_CONTROL,
"WSF_GRID_CONTROL": WSF_GRID_CONTROL
};
_ref = window.states;