Hello,
we enter some number into a cell and at leaving this cell, we fire an ajax request to autocomplete some cells in this row. this works good for existing rows (rowid exists on tr data-id) and also for new rows (no row id).
our setValue wrapper for existing and new rows:
setCellValue: function (gridId, rowId, colKey, value) { if (rowId == undefined || !rowId || rowId == "") { $("#" + gridId).igGridUpdating("editorForKey", colKey).igEditor("value", value); } else { $("#" + gridId).igGridUpdating("setCellValue", rowId, colKey, value); } }
problem: we also need to set values to hidden columns. this works, if the hidden cell is not in a new row, an id exists. writing into a hidden cell using "editorForKey" does not work, because there is no editor for a hidden cell.
any idea how to resolve this issue? we prefer nice solutions :) (without setting some global stuff and setting cell at rowEditingEnded or so.. :) )
thanks in advance.
When the valueChanged event of an specific editor is fired, we use the entered value of that cell and do an ajax request do get some additional values from the server. afterwards, we use our setCellValue function (which is a wrapper of the igGridUpdating or the .igEditor("value", value) function, depends on whether we want to set a cell in a new or existing row) to set the values into the cells.
[###
$("#" + gridId).igGridUpdating("setCellValue", rowId, colKey, value); does only work, if the row still exists. that means you are only able to edit existing rows with this method.
to edit a new row (rowID is still -1, row never fired generatePrimaryKeyValue, Done was never clicked) it is only possible to set the values into the editors using $("#" + gridId).igGridUpdating("editorForKey", colKey).igEditor("value", value);
###]
the problem only occurs, if you try to set a value to a hidden column-cell if the row is new (so never clicked "done" to get it into transactionlog/to get it comitted, ...). a hidden cell has no editor, so you can not call editorForKey to set the value.
we use a dirty workaround now: if a new cell (we want to set a value to) is hidden, I set the defaultValue of that cell and at rowEditingEnding, igGridUpdating is automatically using the defaultValue for that cell. This kills the common defaultValue functionality, but works for us at the moment.
did I miss a built-in way to solve this?
please provide a real solution. :)
yours.
Hello Max,
After reviewing your request, I have a few questions for you. When is the setCellValue function you have being fired? Is it being called on the editCellEnding event? The reason I am led to believe this is because you said that after leaving a cell, you fire an ajax request to autocomplete some cells in this row. Also, this set setCellValue function is not meant to be confused with the setCellValue method we have in igGridUpdating, correct? I wanted to be sure because the names of the two were the same and wanted to make sure there was no confusion there. Also, could you clarify your problem statement a bit for me. In particular, I was unable to understand the situation where your method was not working. Is it only when you do add new row that you have this issue? It may be very helpful to me if you could provide a short, isolated sample showing this issue, or just provide the code which pertains to the igGrid and this issue in particular. I look forward to hearing back from you so that I can look into providing a solution for you as soon as possible.
Thank you for contacting Infragistics!
We received your support request concerning autocompletion of cells in the igGrid, and I have been assigned to assist you on the matter. Infragistics is dedicated to helping you solve this issue. Our team and I have done an initial review of your request and I will be researching the behavior you are describing to try and find an alternative for you. I will get back to you by the end of the day tomorrow with more information or questions for you.