Hello,
I am trying to use the igGridUpdating with an igCombo. My use case is that i have a 'Category' dropdown and a 'SubCategory' dropdown. When the user selects a category, I fetch the subcategories for that category and populate the subcategory igCombo with those values.The problem comes up when there is already a value in the subcategory. When I set the dataSource of the subcategory igCombo, the value that is lost and the row becomes dirty. Then when you decide you don't want to change anything and exit or click somewhere else the row thinks you change that subcategory to null and saves that null value.
I've tried setting that value after i set the datasource but setting the value causes the row to become dirty as well. What is the best way to accomplish this?
Thanks,
Erik
Hello Erik,
Thank you for posting in our community.I created a small sample illustrating the described behavior. I am using a cascading combo editor providers for "Country" and "City" columns. When a new country is selected the data source for the city combo editor is changed. However, on my side, when I cancel editing all changes are reverted and cell values are going back to their initial values, respectively cells not being marked as dirty. Please keep in mind that igCombo, which is the base for the editor provider, by design does not accept custom values, which means that if the cell value is not available in the combo`s data source the editor will select the first value from the combo items. In this case my suggestion is setting combo editor`s allowCustomValue to "true" and its mode to "editable". This will ensure that if the cell value is not present in the drop down items it will be set as a value for editor`s input rather than lost. For example:
features.Updating().EditMode(GridEditMode.Row).ColumnSettings(cs => { cs.ColumnSetting().ColumnKey("Status").EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co.DataSource(Url.Action("employee-combo-data")).ID("comboEditor").ValueKey("Value").TextKey("Value").Mode(ComboMode.DropDown)); cs.ColumnSetting().ColumnKey("Country").EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co.DataSource(Url.Action("employee-combo-dataCountries")).ID("comboEditorCountry").ValueKey("Value").TextKey("Value").Mode(ComboMode.DropDown).AddClientEvent("selectionChanged", "selChanged")); cs.ColumnSetting().ColumnKey("City").EditorType(ColumnEditorType.Combo).ComboEditorOptions(co => co.DataSource(Url.Action("employee-combo-dataCities")).ID("comboEditorCity").ValueKey("Value").TextKey("Value").Mode(ComboMode.DropDown).AllowCustomValue(true).Mode(ComboMode.Editable)); cs.ColumnSetting().ColumnKey("Name").Required(true); cs.ColumnSetting().ColumnKey("ProductID").Required(true); });
Observe "City" column editor settings.Please have a look at the my sample here. If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me for further investigation along with steps to reproduce.Please let me know if you have any additional questions regarding this matter.
Thanks for your reply, I've implemented some of your options into my code but I've change to cell editing instead of row and that has made this easier for me. I ran into another issue now though. It's hard for me to pin down what's happening and I'm not sure I can reproduce it 100% but there are some instances when finished editing for a cell, the row selection won't change afterwards. It's stuck selecting the row that I just finished editing. I can edit a different cell and click away and it's fine, but I can't select any other row on the grid.I can submit another issue if you would like.
Thank you for getting back to me.
I am glad that you managed to achieve your requirement.Thank you for using Infragistics components!
I think I just fixed this issue actually by using the editCellEnded event in my logic instead of the editCellEnding event. Thanks for your help Vasya!