itemsByValue method
This commit is contained in:
@@ -94,11 +94,8 @@ $(function(){
|
||||
//collect text of checked boxes
|
||||
value2htmlFinal: function(value, element) {
|
||||
var html = [],
|
||||
/*jslint eqeq: true*/
|
||||
checked = $.grep(this.sourceData, function(o){
|
||||
return $.grep(value, function(v){ return v == o.value; }).length;
|
||||
});
|
||||
/*jslint eqeq: false*/
|
||||
checked = $.fn.editableutils.itemsByValue(value, this.sourceData);
|
||||
|
||||
if(checked.length) {
|
||||
$.each(checked, function(i, v) { html.push($.fn.editableutils.escape(v.text)); });
|
||||
$(element).html(html.join('<br>'));
|
||||
|
@@ -236,20 +236,7 @@ List - abstract class for inputs that have source option loaded from js array or
|
||||
});
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
//search for item by particular value
|
||||
itemByVal: function(val) {
|
||||
if($.isArray(this.sourceData)) {
|
||||
for(var i=0; i<this.sourceData.length; i++){
|
||||
/*jshint eqeqeq: false*/
|
||||
if(this.sourceData[i].value == val) {
|
||||
/*jshint eqeqeq: true*/
|
||||
return this.sourceData[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@@ -47,10 +47,13 @@ $(function(){
|
||||
},
|
||||
|
||||
value2htmlFinal: function(value, element) {
|
||||
var text = '', item = this.itemByVal(value);
|
||||
if(item) {
|
||||
text = item.text;
|
||||
var text = '',
|
||||
items = $.fn.editableutils.itemsByValue(value, this.sourceData);
|
||||
|
||||
if(items.length) {
|
||||
text = items[0].text;
|
||||
}
|
||||
|
||||
Select.superclass.constructor.superclass.value2html(text, element);
|
||||
},
|
||||
|
||||
|
Reference in New Issue
Block a user