Hello,we recently ran into a problem with igCombo, and we are not sure how to deal with it.We want to use a multiselectable combobox dropdown with ticks defined like this:
@(Html.Infragistics() .ComboFor(model => model.Committees) .ID("SubTopicCommitteeCombo") .Width("150") .LoadOnDemandSettings(lods => lods.Enabled(true).PageSize(25)) .DataSourceUrl(Url.Action("GetComboCommittees")) .ValueKey("CommitteeID") .TextKey("FullTitle") .CompactData(true) .EnableClearButton(false) .MultiSelectionSettings(msw => msw.Enabled(true)) .MultiSelectionSettings(msw => msw.ShowCheckBoxes(true)) .DataBind() .Render() )
It all works fine, until we reload the page, submit or fetch any ticked data.Now the problem is basically:So far, everytime we reload the page and fetch data, no matter what we previously selected, the combobox dropdown has no items ticked.Therefore: How does the model property assigned to the combobox dropdown have to look like in C#, so the data is submitted and fetched correctly?
Thanks in advance.
Hello,
Thank you for contacting us.
1. How to fetch preselected records correctly? - In order to fetch records which are preselected, you should use SelectedValues property. As written in the documentation "that option is supported only for currently available list of items. When load-on-demand or filtering is enabled, then attempt to select not loaded item will fail." Therefore you should load all the items.
2. How to submit selected/unselected records? - You can attach on "selectedChanged" client-side event and perform AJAX query to apply your change to the server.
Please review the following sample for the 2 changes:
Let me know if this helps you.
Hello,Yes, thank you, that was very enlightening!Now, something else came up as well regarding comboboxes:In igGrids, we use those comboboxes as well, but they seem to behave differently and offer different options.
We define the Responsible column as follows:
.Columns(column => {column.For(x => x.ResponsibleID).HeaderText("Responsible").FormatterFunction("lookupContacts").Hidden(ViewBag.UserSettingsTopic.IsHidden("ResponsibleID"));}
.Features(feature => {feature.Selection().MultipleSelection(false).Mode(SelectionMode.Row).Activation(true).MouseDragSelect(false);feature.Updating().EnableAddRow(false).ColumnSettings(cs => {cs.ColumnSetting().ColumnKey("ResponsibleID").Required(true).EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co .DataSource(Url.Action("GetComboContacts")) .ValueKey("ContactID") .TextKey("FullTitle") .EnableClearButton(false) .CompactData(false));}} The problem is:When evoking the igGrid inline editing, the ResponsibleID combobox dropdown should have a value set based on the ValueKey/TextKey mapping, we expected.But instead, it just initializes the combobox dropdown with an empty field everytime the inline editing is evoked.
How can we enable the expected behaviour?
Thanks in advance, again.
yes, everything is in order there and the combobox dropdown handles the correct list of items. But the problem lies somewhere else.I'll illustrate it in a picture attached to this post.
Before editing, the name is displayed as expected.But, while editing, the previous selection is seemingly unselected and replaced by an empty combobox dropdown entry field.
Now, our problem is: while editing, we want the selection to remain the same as before editing.How can we achieve this behaviour?
To achieve the desired behavior, you can change the combo mode to dropdown like this:
If you have any other issues, please let me know.
first of all, thank you for your quick reply and helpful advice!Now, this is almost what we want.There is just one last problem left:The dropdown combobox shows only the first entry in the dropdown entry field, instead of showing the previously selected item.I.e.: During editing the combobox entry field holds whatever is the first entry in the dropdown, instead of the perviously set Müller, Hans, as seen before editing.We need the selected item that is set in the igGrid before editing though.How can we accomplish that?
Hello again,
In order to have the correct contact selected, the value of ResponsibleID and the value of the "Müller, Hans" ContactID should be the same. Let's assume you have only one row with one column ResponsibleID, the data would look like this:
I look forward to hearing from you.
I thought so too, but:I looked at the data returned by the controller on the server through .DataSourceUrl(Url.Action("GetAgendaItems")) and saw, that the ID is correctly setto "Hans Müller". Which is also apparent, when looking at the igGrid before editing. It shows "Hans Müller".Only during editing, does the entry change to whichever item is first in the combobox.
Therefore:I'm not sure what I'm doing wrong.
Hello,We tried your sample solution and it works. But when applying the workaround to our project, but we couldn't make it work.
As additional information, we want to add:When setting .Mode(...) to Dropdown in the igGrid inline combobox, we could not bring the value to be set even after multiple edit attempts.
We found that the issues we have with the igGrid inline combobox dropdowns seem to be a known issue since 2013 and we were wondering, if there is any way that the behaviour of the dropdowns will be corrected anytime soon, so we don't have to rely on the workaround you provided?
A sincere thank you to you for your help and time.
We cannot reproduce the issue. I am attaching a working sample based on your code. Please feel free to modify it and send it back, or send a small sample project of your own if you have one.
Hello,I'm sorry, this didn't fix our problem.Adding the event to open the combobox inside the iggrid did not result in the expected behaviour and instead changed nothing. Is there any other way to do this?
And, as a weird sidenote:In a popup we define the following combobox via ComboFor:
@(Html.Infragistics() .ComboFor(m => m.ResponsibleID) .ID("TopicResponsibleCombo") .Width("150") .LoadOnDemandSettings(lods => lods.Enabled(true).PageSize(25)) .DataSourceUrl(Url.Action("GetComboContacts")) .ValueKey("ContactID") .TextKey("FullTitle") .CompactData(false) .EnableClearButton(false) .DataBind() .Render() )
And HERE, it works like a charm. It prefetches all the data correctly and has a combobox search field and all that.The only apparant differences are:- This is a ComboFor instead of a combobox inside an igGrid.- The DataSourceUrl function is available which we use.
I hope this somehow helps understand the problem, so we can fix it once and for all.
I managed to reproduce the issue - it happens only the first time we enter the edit mode. You should load the combo data before that. This could happen on "Rows Rendered" event. I am providing detailed example of the desired behavior:
And the Controller:
I hope this would help.
sorry, I have to specify: The ID is set to 12, which is the ID of the object with the FullName "Hans Müller" and the igGrid definition of that cell is this:
.Columns(column => {...column.For(c => c.SpeakerID).HeaderText("SpeakerID").FormatterFunction("lookupContacts").Hidden(ViewBag.UserSettingsAgendaItem.IsHidden("SpeakerID"));....ColumnSettings(cs => {...cs.ColumnSetting().ColumnKey("SpeakerID").EditorType(ColumnEditorType.Combo).Required(true).ComboEditorOptions(co => co.DataSource(Url.Action("GetComboContacts")).ValueKey("ContactID").TextKey("FullTitle").EnableClearButton(false).Mode(ComboMode.DropDown)).ReadOnly(!ViewBag.PermissionAgendaItem.Write);...
The lookupContacts only maps the given c.SpeakerID to the FullName.