autosubmit method
This commit is contained in:
@@ -127,7 +127,14 @@ To create your own input you should inherit from this class.
|
||||
**/
|
||||
escape: function(str) {
|
||||
return $('<div>').text(str).html();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
attach handler to automatically submit form when value changed (usefull when buttons not shown)
|
||||
**/
|
||||
autosubmit: function() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Abstract.defaults = {
|
||||
|
@@ -112,7 +112,15 @@ $(function(){
|
||||
|
||||
activate: function() {
|
||||
this.$input.find('input[type="checkbox"]').first().focus();
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.find('input[type="checkbox"]').on('keydown', function(e){
|
||||
if (e.which === 13) {
|
||||
$(this).closest('form').submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Checklist.defaults = $.extend({}, $.fn.editableform.types.list.defaults, {
|
||||
|
@@ -95,7 +95,16 @@ $(function(){
|
||||
clear: function() {
|
||||
this.$input.data('datepicker').date = null;
|
||||
this.$input.find('.active').removeClass('active');
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('changeDate', function(e){
|
||||
var $form = $(this).closest('form');
|
||||
setTimeout(function() {
|
||||
$form.submit();
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@@ -112,7 +112,16 @@ $(function(){
|
||||
|
||||
clear: function() {
|
||||
this.$input.datepicker('setDate', null);
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('mouseup', 'table.ui-datepicker-calendar a.ui-state-default', function(e){
|
||||
var $form = $(this).closest('form');
|
||||
setTimeout(function() {
|
||||
$form.submit();
|
||||
}, 200);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@@ -45,7 +45,13 @@ $(function(){
|
||||
text = item.text;
|
||||
}
|
||||
Select.superclass.constructor.superclass.value2html(text, element);
|
||||
}
|
||||
},
|
||||
|
||||
autosubmit: function() {
|
||||
this.$input.on('change', function(){
|
||||
$(this).closest('form').submit();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Select.defaults = $.extend({}, $.fn.editableform.types.list.defaults, {
|
||||
|
Reference in New Issue
Block a user