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.
Hello Max,
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.
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.
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.
After reviewing your post with my team, I am not sure that what you're doing has a 'real' solution as you suggest. Because this is a custom implementation, and no editor is created for hidden columns, there are no built-in ways for you to solve this. If your workaround is working successfully for you now, I would stick with that. The only other option I can see is if you manually edit the actual data set and send that back to your server. In other words, if you have JSON data, you can try adding the value for the hidden column directly into the new JSON object you are creating and adding to your data source rather than adding it through the grid. This way, you keep the Grid, which is not meant to do this sort of operation on hidden columns, out of the transaction and still have a value for the hidden column. Please let me know if you have any further questions.
Has the ability to update read-only or hidden cells for a new row been added in a newer release yet? I am on 2015.1 and am not finding a way to do it.
Is there anything else I can assist you with on the matter? Please do not hesitate to contact me with more questions.
Thank you very much for your feedback. I can assure you that our team at Infragistics emphasizes listening to our customer's needs for the direction of our future products. This being said, you can suggest new product ideas for future versions (or vote for existing ones) at http://ideas.infragistics.com.
There are many benefits to submitting a product idea:
- Direct communication with our product management team regarding your product idea.
- Notifications whenever new information regarding your idea becomes available.
- Ability to vote on your favorite product ideas to let us know which ones are the most important to you. You will have ten votes for this and can change which ideas you are voting for at any time.
- Allow you to shape the future of our products by requesting new controls and products altogether.
- You and other developers can discuss existing product ideas with members of our Product Management team.
Steps to create your idea:
1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).
2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)
3. Add your product idea and be sure to be specific and provide as much detail as possible. Explain the context in which a feature would be used, why it is needed, why it can’t be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing
The Product Idea site puts you in the driver’s seat and allows you to track the progress of your ideas at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Thank you for contacting Infragistics.
hi, well, our workaround works for us atm.
but I think there should be a built-in feature to add a new row and set values to all cells (including hidden ones) by javascript. it is possible to write to hidden columns in existing rows and should also be possible to write to new rows.
In addition I do not understand why your setCellValue method can not set values to new rows, that does not make sense (seen as an user of your grid, I know that there are technical differences in new and existing rows) at all. Please add this features.