Is it possible to have an igGrid control with a column and have the cells in that one column be different types of editors based on some event? In my example, I am going to have 3 columns in my grid:
1. Column name: a drop down of columns from a database table
2. Operand: a drop down of operands such as =, <, >, <=, etc.
3. value: this is the column I want to have different types of editors, based on the entry chosen from the "column name" drop down in column 1 (if it's a numeric field, show a numeric editor, if it's a string, show a text editor, if it's a string with a configurable list, show a drop down with that list, etc.).
Is this possible, and if so, any pointers on how to do it?
Hello Ryan,
You can check out the attached sample which demonstrates this functionality. It doesn't exactly replicates your scenario, but you can see how to modify dynamically the column editor.
Best regards,Martin PavlovInfragistics, Inc.
A couple of follow-up questions . . . it looks like you can only pull this off if the editMode is "cell"? Is that true? is there a way to do this with RowEditTemplate?
Also, when I implement this, the drop downs are bigger than the grid cells they are in for some reason. How do you make them the same size? here's what I have in MVC code, and what it looks like is in the attached image.
.Columns(column =>
{
column.For(x => x.Field).HeaderText(
ResourceManager.GetStringResource(ThreadManager.CurrentSession, "FIELD", ResourceGroups.Text)).Width("35%");
column.For(x => x.Operand).HeaderText(
ResourceManager.GetStringResource(ThreadManager.CurrentSession, "OPERAND", ResourceGroups.Text)).Width("30%");
column.For(x => x.Value).HeaderText(
ResourceManager.GetStringResource(ThreadManager.CurrentSession, "VALUE", ResourceGroups.Text)).Width("35%");
})
.Features(features => {
features.Updating()
.EnableAddRow(
true)
.EnableDeleteRow(
.EditMode(
GridEditMode.Cell)
.ShowDoneCancelButtons(
.StartEditTriggers(
GridStartEditTriggers.DblClick)
.AddClientEvent(
"editCellStarting", "WebUi.prototype.setAdvancedCriteriaValueControlType(evt, ui)")
.ColumnSettings(settings =>
settings.ColumnSetting().ColumnKey(
"Field").EditorType(ColumnEditorType.Combo)
.ComboEditorOptions(options => options.ValidatorOptions(validators => validators.OnBlur(
true).OnChange(false).OnSubmit(true).FormSubmit(true).KeepFocus(ValidatorKeepFocus.Never).ShowIcon(true))
.DataSource(columnList.OrderBy(x => x.DisplayText))
.TextKey(
"DisplayText")
.ValueKey(
"Identifier"))
.Required(
true).Validation(true);
"Operand").EditorType(ColumnEditorType.Combo)
.DataSource(operandList.OrderBy(x => x.DisplayText))
"DisplayText"))
"Value").EditorType(ColumnEditorType.Text)
.TextEditorOptions(options => options.ValidatorOptions(validators => validators.OnBlur(
true).OnSubmit(true)))
});