Hy,
I want to make a dynamically populated html select for a select cell. I extract some information from a database which is different for every row item. The problem is that the editor loses the initial data and I don't konw how to keep some data for a specific cell. Has someone done this ?
function StandardSelectCellEditor($container, columnDef, value, dataContext) {
var $input;
var $select;
var defaultValue = value;
var scope = this;
this.init = function() {
$input = $("<INPUT type=hidden />");
$input.val(value);
}
$input.appendTo($container);
$select = $("<SELECT tabIndex='0' class='editor-yesno'>");
jQuery.each(value, function() {
$select.append("<OPTION value='" + this + "'>" + this + "</OPTION></SELECT>");
});
$select.append("</SELECT>");
$select.appendTo($container);
$select.focus();
};
this.destroy = function() {
//$input.remove();
$select.remove();
};
this.focus = function() {
$select.focus();
};
this.setValue = function(value) {
$select.val(value);
defaultValue = value;
};
this.getValue = function() {
return $select.val();
};
this.isValueChanged = function() {
return ($select.val() != defaultValue);
};
this.validate = function() {
return {
valid: true,
msg: null
};
};
this.init();
};