Hello,
We currently have many grids use a RowEditDialog for editing/adding records. Foreign keys for these grids are converted into combo boxes and are linked to a remote data source using the DataSourceUrl. When the RowEditDialog is loaded in edit mode, we do have some custom code that sets the initial value of the comboboxes to what's in the grid because this is not getting loaded automatically for some reason (i've attached the custom code we are using to do this). This all works fine; however, when we try to implement LoadOnDemand with our comboboxes, the values are not getting set properly. This happens when the currently selected value is not in the first page. We would like to use LoadOnDemand as some of our foreign keys can have up to 100k rows.
Do you have a recommended way for accomplishing this? Is there a way to page to the currently selected value so that we can set the initial combo value?
Thanks,
Paul
Hello Paul,
Thank you for contacting Infragistics!
How are you setting up the grid/combo? I would recommend setting it up through the editorOptions, this way you should be able to set the dataSourceUrl through this way and the dialog/combo should grab the value from the grid instead of writing custom code:
https://www.igniteui.com/help/api/2017.1/ui.iggridupdating#options:columnSettings.editorOptions
https://www.igniteui.com/help/api/2017.1/ui.igcombo#options:dataSourceUrl
What version are you using?Do you have an isolated sample that demonstrates the behavior you are seeing?
Thank you for the update. I would like you to check the console for any errors when you use the combo, opening/selecting etc. If there is an error on selecting this may lead to why you are having an issue with it. As a note since you are setting the dataSourceUrl you don’t have to set the dataSource to null, I would remove that. In addition looking at the API for the igCombo it doesn’t have a “compactData” property, I would remove this as well. You are also setting the “columnIndex” property in the column settings of the Updating feature, this property does not exist, there is just “columnKey” for setting the column you want to use.
Hi Mike,
Thanks for information. There are no errors when opening the roweditdialog or using the combo.
I'm created the grid and editors using the MVC helpers, so I don't really have a lot of control over some of the properties you are mentioning. I'm not setting the DataSource in C#, and doing so appears to generate a dataSource: null markup. Also, I'm not sure where the compactData property is coming from and I don't see this setting in the C# classes. Same with ColumnIndex. These must be getting set somewhere in Infragistics.Web.MVC.dll.
If you have a standalone MVC application with a grid and roweditdialog that you can send to me, I can probably help with creating a standalone example of what I am seeing. I tried to create one from the Samples that are provided, but I couldn't seem to isolate a single sample.
Thank you for the update. I am attaching a basic MVC sample if the igGrid that uses the dialog as an editor. The CSS/JS references are in the “Views\Shared\_Layout.cshtml” you will want to change those to point to your scripts. Please modifiy the sample to reproduce the behavior you are seeing.
Attached is an example that duplicates what I am seeing.
The underlying issue is that when a user edits a row, the combobox should display the currently selected value. I put our custom code for accomplishing this in the Index.cshtml file. The underlying field for the combobox is an integer, but we want to select the name instead of the integer. I modified your example to add another table called ProductGroups. The idea is that each Product has a foreign key for a Product Group. In Jquery, we use a method lookupGridColumnName to generate the initial grid value. Then, we a user edits a row, we use the 'iggridupdatingroweditdialogafteropen' event to set the initial combo value. If you take out the 'iggridupdatingroweditdialogafteropen' event, then the combobox value does not get set.
If you edit the row with the Id of 5, this just demonstrate the original issue we were seeing with using LoadOnDemand.
Thank you for the update. It seems like the combo not populating when data for the editor is remote may be an issue. I have logged it for further inveisgation with the ID 242390. I have created a private case (CAS-187057-K5N4D3) where I will provide you further information.