fix address value2html
This commit is contained in:
parent
111f983f5d
commit
f79e92c14a
src
@ -558,10 +558,10 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
|||||||
**/
|
**/
|
||||||
value: null,
|
value: null,
|
||||||
/**
|
/**
|
||||||
Callback to perform custom displaying of value in element's text.
|
Callback to perform custom displaying of value in element's text.
|
||||||
If <code>null</code>, default input's value2html() will be called.
|
If <code>null</code>, default input's value2html() will be called.
|
||||||
If <code>false</code>, no displaying methods will be called, element's text will no change.
|
If <code>false</code>, no displaying methods will be called, element's text will no change.
|
||||||
Runs under element's scope.
|
Runs under element's scope.
|
||||||
Second parameter __sourceData__ is passed for inputs with source (select, checklist).
|
Second parameter __sourceData__ is passed for inputs with source (select, checklist).
|
||||||
|
|
||||||
@property display
|
@property display
|
||||||
@ -570,7 +570,8 @@ Makes editable any HTML element on the page. Applied as jQuery method.
|
|||||||
@since 1.2.0
|
@since 1.2.0
|
||||||
@example
|
@example
|
||||||
display: function(value, sourceData) {
|
display: function(value, sourceData) {
|
||||||
$(this).html('<b>'+value+'</b>');
|
var escapedValue = $('<div>').text(value).html();
|
||||||
|
$(this).html('<b>'+escapedValue+'</b>');
|
||||||
}
|
}
|
||||||
**/
|
**/
|
||||||
display: null
|
display: null
|
||||||
|
@ -31,14 +31,16 @@ $(function(){
|
|||||||
$.extend(Address.prototype, {
|
$.extend(Address.prototype, {
|
||||||
render: function() {
|
render: function() {
|
||||||
Address.superclass.render.call(this);
|
Address.superclass.render.call(this);
|
||||||
|
|
||||||
// this.$input.
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//standard way to show value in element. Used only if display option not defined.
|
||||||
value2html: function(value, element) {
|
value2html: function(value, element) {
|
||||||
var html = value.city + ', ' + value.street + ' st., bld. ' + value.building;
|
if(!value) {
|
||||||
$(element).text(html);
|
$(element).empty();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var html = $('<div>').text(value.city).html() + ', ' + $('<div>').text(value.street).html() + ' st., bld. ' + $('<div>').text(value.building).html();
|
||||||
|
$(element).html(html);
|
||||||
},
|
},
|
||||||
|
|
||||||
html2value: function(html) {
|
html2value: function(html) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user