Hello everybody!
I succeed to insert the selected value of a combo, in a column of the igGrid.
Then, I want to insert several values at the same time (in one column of one row). The type of object of this column is List<int> (a list of ID)
How inserting several values?
Here a part of my code:
----------------------------------------------------------------------
@(Html.Infragistics().Grid<A_Form_Model>()
.ID("grid_FormA")
.PrimaryKey("IdLineA")
.RenderCheckboxes(true)
.AutoGenerateColumns(false)
.AutoGenerateLayouts(false)
.RestSettings(rest =>
rest.RestSetting()
.Create(c => c.RestVerbSetting().Url("/api/linea").Batch(true))
.Update(u => u.RestVerbSetting().Url("/api/linea"))
.Remove(r => r.RestVerbSetting().Url("/api/linea"))
)
.Columns(column =>
{
column.For(x => x.IdLineA).Hidden(true);
column.For(x => x.ReferenceAIEA).Width("80px");
column.For(x => x.ListProducts).Width("400px");//It is here I want to add several values
column.For(x => x.IdAddressFrenchParticipant).Width("80px").FormatterFunction("lookupAd");
})
.Features(features =>
features.Selection().Mode(SelectionMode.Cell).MultipleSelection(true);
features.RowSelectors().EnableCheckBoxes(false).EnableRowNumbering(true);
features.Updating().EditMode(GridEditMode.RowEditTemplate).EnableAddRow(true)
.ColumnSettings(settings =>
settings.ColumnSetting().ColumnKey("IdAddressFrenchParticipant").EditorType(ColumnEditorType.Combo)
.ComboEditorOptions(options => options.DataSource(ViewBag.Source).ValueKey("IdAddress").TextKey("AddressText"));
settings.ColumnSetting().ColumnKey("ListProducts").EditorType(ColumnEditorType.Combo)
.ComboEditorOptions(options => options.AllowCustomValue(true).MultiSelection(ComboMultiSelection.OnWithCheckboxes).DataSource(ViewBag.Cycles).ValueKey("IdProduct").TextKey("Label"));
});
.EnableHoverStyles(true)
.Height("500px")
.Width("100%")
.DataSourceUrl("/api/linea")
.LocalSchemaTransform(true)
.DataBind()
.Render()
------------------------------------------------------
What is missing?
Regards,
F2O
PS: Thanks for your help, Petar.
Hey,
After many tests, I found a way to get and save an object. For example, I have several objects (I name it "Contact") and a Contact has a list of phone numbers.
What I did:
I am happy to find a solution even if it is not very neat.
Rehello,
I had an idea and it is convert a list to string (by using "join(',')) and I still get the first value of the igCombo. Then, I noticed something. When I am saving the object, igCombo("value") is gotten instead of igCombo("values") .
For example, I select two values : 2 and 3 => igCombo("value") returns 2 and igCombo("values") returns [2,3].
How get igCombo("values") instead of igCombo("value")??
Please, I need help, any idea or any advice.
Excuse me for the missing part of my previous response:
Moreover, the list of integers of the object is null.
How can I get the values?
Thanks,
Hello Petar,
Thanks for your response.
I followed the sample you indicated.
$(".select").on("igcomboselectionchanged", function (event, args) {$(".select").empty();for (var i = 0 ; i < args.items.length ; i++) {$(".select").append(args.items[i].value); }});
But I don't success to create a list for saving it. In fact, I have a object to edit, that contains a list of integers.
When I am saving, the modelState.IsValid is returned false.