i has a iggrid that has updatting feature and that has 1 editor. each record will show editor type difference from each other. i want to change from text editor to combobox editor and gainsay
who can help me?
noone help me?
Thanks for your helper!
Now i'm using the igeditor to change from text editor to listdropdown(only show 1 column) but that can not show many column like the combobox so i change to combobox editor
have you any ways to resolve this problem?
Here is my code!
var indicesValueList = @Html.Raw(Json.Encode(New TPG.CommonDB.IndiceRepository().SelectData));// ID, Code, Description
$("#ugrdVariables").igGrid({ columns: [ { headerText: "Variables", key: "sVariableName", dataType: "string", width: "100" }, { headerText: "Values", key: "DisplayText" }, { key: "iCusipFormula_Values_ID", hidden: true }, { key: "intRateTerm_ID", hidden: true }, { key: "intRate_Variable_ID", hidden: true }, { key: "FormulaVariable", hidden: true }, { key: "sVariableDesc", hidden: true }, { key: "IsChanged", hidden: true }, ], width: "100%", height: "165px", primaryKey: 'iCusipFormula_Values_ID', autoGenerateColumns: false, dataSource: dataSource, autoCommit: true, dataSourceType: 'json', features: [ { name: "Updating", enableAddRow: false, enableDeleteRow: false, editCellStarting: setValueEditor, columnSettings: [ { columnKey: "sVariableName", editorOptions: { readOnly: true } }, { columnKey: "DisplayText", required: true, editorOptions: { button: "dropdown" } } ], editRowEnded: function (evt, ui) { var strVarDesc = $("#ugrdVariables").igGrid("getCellValue", ui.rowID, "sVariableName"); if (strVarDesc != null && strVarDesc.substring(0, 5) == 'Index') { $("#ugrdVariables").igGridUpdating("setCellValue", ui.rowID, "sVariableDesc", SearchIndexID(ui.values['DisplayText'])); } else { var displayText = ui.values['DisplayText']; if (displayText == null) { displayText = ""; } $("#ugrdVariables").igGridUpdating("setCellValue", ui.rowID, "sVariableDesc", displayText); } var oldValue = ui.oldValues["DisplayText"]; var newValue = ui.values["DisplayText"]; if (oldValue != newValue) { $("#ugrdVariables").igGridUpdating("setCellValue", ui.rowID, "IsChanged", true); RebuildFormula($("#ugrdVariables").igGrid("option", "dataSource")); } } } ] });
function setValueEditor(evt, ui) { if (ui.columnKey == "DisplayText") { var recordObj = ui.owner.grid.findRecordByKey(ui.rowID); var sVariableName = ''; if (recordObj) { sVariableName = recordObj.sVariableName; } if (sVariableName.substring(0, 5) == 'Index') {//if value is index then show combobox or anythingelse like this that can show Code, Description at once(i have a template if it is //combobox) else show texteditor normaly
var vList = $.map(indicesValueList, function (item) { return item.Description; }); $(ui.editor).igEditor("option", "type", "combo"); $(ui.editor).igEditor("option", "buttonHidden", false); $(ui.editor).igEditor("option", "listItems", vList); $(ui.editor).igEditor("option", "textKey", 'Description'); $(ui.editor).igEditor("option", "textKey", 'ID'); } else { $(ui.editor).igEditor("option", "type", "text"); $(ui.editor).igEditor("option", "listItems", null); $(ui.editor).igEditor("option", "buttonHidden", true); } }}
Hello Cuong,
Thank you for posting in our community.
The functionality that you are trying to achieve is not currently supported. The reason is that by design only one editor is rendered per column. However, if you would like to change the type of editor based on the cell value this could be implemented with a custom editor provider.
In order to ensure that your issue is addressed correctly could you please let me know what is the condition on which the type of editor depends? Is it the value of the cell currently being edited or something else. This information is going to be highly appreciated and will help me determine how to proceed further.
Looking forward to hearing from you.
no one help me!