Hello,
I have attached code for the igGrid and the derived grid which contains ColumnUpdate setting. The Issue I am facing is as below,
In my grid I have 5 columns and when I try adding new row to the grid I am getting below error for 3rd column,
0x800a139e - JavaScript runtime error: Updating did not have enough information to properly determine the type of editor to use for column: SHCd
I am also attaching pic of the Visual studio debugger. Can you pls help me with the right settings I need to do in my columnUpdateSettings in order to make the Add New row functionality work for the attached grid (msalloc.placcountgrid.js).
Warm Regards,
Parag Dave
Thank you for using Infragistics forums!
For Updating to determine the type of editor to use automatically the column must have data type defined in the grid's column collection. Please, add dataType properties for the columns that throw this error. You could also specify the type of editor to use directly through the editorType property in Updating's columnSettings.
I hope this helps! Please, let me know if you have any other questions or concerns!
Best regards,
Stamen Stoychev
Hi Stamen,
I added the datatypes for all the grid columns and I am able to get away with the above error. But there are few columns in the grid that are marked as readOnly in the columnUpdateStaticSettings, like below,
{ columnKey: columns[msalloc.enums.receiverPoolExternalSegmentCodeIndex], editorType: "text", readOnly: true, defaultValue: "", editorOptions: { maxLength: 4 } }
and I want to switch readOnly to false based on some other condition when the Add row is clicked. But when I do this in below code, the text editor is not getting enabled. This is one of the key functionality for business requirement. Do I need to change the way I am setting the readOnly in below code?
EnableDisableGridColumn: function (columnIndex, isEnabled, defaultCode, defaultDesc) { var descColumnIndex = columnIndex + 1; $(this.element).igGridUpdating("option", "enableAddRow", false);
//Get var columnSettings = $(this.element).igGridUpdating("option", "columnSettings");
if (columnIndex >= 0 && columnIndex < columnSettings.length) { columnSettings[columnIndex].readOnly = !isEnabled;
if (defaultCode != undefined) columnSettings[columnIndex].defaultValue = !isEnabled ? defaultCode : ""; if (defaultDesc != undefined) columnSettings[descColumnIndex].defaultValue = !isEnabled ? defaultDesc : ""; //Set $(this.element).igGridUpdating("option", "columnSettings", columnSettings); if (!isEnabled && $(this.element).data("igGridUpdating")._editors && $(this.element).data("igGridUpdating") ._editors[columnSettings[columnIndex].columnKey]) {
$(this.element).data("igGridUpdating")._editors[columnSettings[columnIndex].columnKey].igEditor("destroy"); delete $(this.element).data("igGridUpdating")._editors[columnSettings[columnIndex].columnKey]; } } else { msalloc.log('Invalid columnIndex: "' + columnIndex + '" passed to method msalloc.grid::EnableDisableGridColumn. It must be < ' + columnSettings.length); }
$(this.element).igGridUpdating("option", "enableAddRow", true); }
Thanks,
Hello Parag,
The bolded line won't do anything by itself. The grid needs to re-render to support the change of the columns' readOnly property since each affected cell's aria-readonly attribute should be changed as well. This is done when you set the modified columnSettings array a few lines below:
//Set$(this.element).igGridUpdating("option", "columnSettings", columnSettings);
Unfortunately, my tests show that the cells in the UI for adding rows don't receive this update. I logged this behavior in our internal tracking system with #226001. A case is opened on your behalf with ID: CAS-177332-Q3C6Q2. You can find your active cases under Account - Support Activity in our website. Select your ticket and go to Development Issues tab to view the status of related bugs.
You could try to workaround the issue by calling an internal function in igGridUpdating that is responsible for refreshing the add new row UI. Add the following call after setting the updated columnSettings array.
$(this.element).data("igGridUpdating")._updateAddNewRow();
Please, have in mind that in either case setting the "columnSettings" property will always exit edit mode. You may need to re-enter it (using the startEdit or startAddRowEdit methods) if you execute these read-only updates when the user tries to enter edit mode. Additionally, there is no need to destroy the editors. Updating will always keep only the editors it needs based on which columns are read-only. If you need the following line:
$(this.element).data("igGridUpdating")._editors[columnSettings[columnIndex].columnKey].igEditor("destroy");
for some other purpose, you will also have to change igEditor to the name of the specific editor for the column since there is no longer an encompassing igEditor widget (from Ignite UI 2015.2 onward).
Thanks for your reply, but the i was not able to implement grid cell readonly on Add new row with the suggested work around.
Instead after some researched I found that there is a grid event editCellStarting which I used to force disable on a given condition and it worked.