[cleanup] control get_value for dialog fields

This commit is contained in:
Rushabh Mehta 2016-04-22 17:21:48 +05:30
parent 44b0dec6e1
commit 144efb6499
4 changed files with 19 additions and 6 deletions

View file

@ -4,6 +4,9 @@
.result-list {
min-height: 200px;
}
.sort-selector .dropdown:hover {
text-decoration: underline;
}
.list-filters {
position: relative;
}

View file

@ -403,14 +403,15 @@ frappe.ui.form.ControlData = frappe.ui.form.ControlInput.extend({
this.$input.addClass(this.df.input_class);
}
},
set_input: function(val) {
this.$input && this.$input.val(this.format_for_input(val));
set_input: function(value) {
this.value = value;
this.$input && this.$input.val(this.format_for_input(value));
this.set_disp_area();
this.last_value = val;
this.set_mandatory && this.set_mandatory(val);
this.last_value = value;
this.set_mandatory && this.set_mandatory(value);
},
get_value: function() {
return this.$input ? this.$input.val() : undefined;
return this.$input && this.$input.val() || this.value;
},
format_for_input: function(val) {
return val==null ? "" : val;

View file

@ -210,7 +210,7 @@ frappe.hide_progress = function() {
}
// Floating Message
function show_alert(txt, seconds) {
frappe.show_alert = function(txt, seconds) {
if(!$('#dialog-container').length) {
$('<div id="dialog-container"><div id="alert-container"></div></div>').appendTo('body');
}
@ -229,3 +229,6 @@ function show_alert(txt, seconds) {
div.delay(seconds ? seconds * 1000 : 3000).fadeOut(300);
return div;
}
// for backward compatibility
var show_alert = frappe.show_alert;

View file

@ -8,6 +8,12 @@
min-height: 200px;
}
.sort-selector {
.dropdown:hover {
text-decoration: underline;
}
}
.list-filters {
position: relative;