Quiero hacer una selección de html dinámicamente poblada para una celda de selección. Extraigo información de una base de datos que es diferente para cada elemento de la fila. El problema es que el editor pierde los datos iniciales y no sé cómo guardar algunos datos para una celda específica. ¿Alguien ha hecho esto antes?Editor de selección de SlickGrid
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();
};
La gente puede apreciar este enlace http://onmylemon.co.uk/2014/06/writing-an-editor-for-slickgrid/ y le dará una buena base para escribir editores para SlickGrid. – onmylemon