Voglio fare una selezione html dinamicamente popolata per una cella selezionata. Estraggo alcune informazioni da un database diverso per ogni articolo di riga. Il problema è che l'editor perde i dati iniziali e non so come mantenere alcuni dati per una cella specifica. Qualcuno l'ha già fatto prima?Seleziona editor 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();
};
Le persone potrebbero apprezzare questo link http://onmylemon.co.uk/2014/06/writing-an-editor-for-slickgrid/ che ti darà una buona base per scrivere editor per SlickGrid. – onmylemon