Hi all,
I need to add comment column in the iggrid but the grid only shows less number of characters.So i decide to show the comment in the popup.
and edit the comment and i want to save the edited comment back to the cell from the popup.Kindly Please help me with this.
Hello Lakshmi,
Thank you for posting in our community.
Once the new comment is entered, the value of the textbox can be retrieved and set to the igGrid`s cell. This can be achieved by using the setCellValue method. This method sets a cell value for the specified cell. It also creates a transaction and updates the UI. setCellValue has three parameters :
For example:
//handle Save button click
$("#saveButton").click(function(){
//retrieve text box value textboxval = $("#commentTxt").val();
//set this value to the igGrid`s cell $("#your_grid_id").igGridUpdating("setCellValue", 5, "YourColumnKey", textboxval);
});
Please let me know if you need any further assistance with this matter.
Hi Vasya,
Thank you for your response.
I have tried your method but its not working for me.Kindly assist me to correct my code.
Below code is cell click event code to open the dialog box.its working fine but i used this code before features.this code is not working inside the features.Is there any event that works as similar to cellclick?
cellClick: function (evt, ui) { if(ui.colKey=="Comment") { rowId = ui.rowIndex; colKey=ui.colKey; cellValue =ui.cellElement.textContent; document.getElementById("inputComment").innerHTML =cellValue; $('#CommentSection').modal('show'); } }, features: [
//after the cell click
$("#Savebtn").click(function(){
//retrieve text box value textboxval = $("#inputComment").val(); //set this value to the igGrid`s cell $("#Grid").igGridUpdating("setCellValue", rowId, "Comment", textboxval); $('#CommentSection').modal('hide'); });
///the error i am getting after the run
4jquery-2.1.4.js:250 Uncaught Error: cannot call methods on igGridUpdating prior to initialization; attempted to call method 'setCellValue' at Function.error (jquery-2.1.4.js:250) at HTMLDivElement.<anonymous> (jquery-ui-1.11.4.js:502) at Function.each (jquery-2.1.4.js:374) at jQuery.fn.init.each (jquery-2.1.4.js:139) at jQuery.fn.init.$.fn.(anonymous function) [as igGridUpdating] (localhost:25461/.../jquery-ui-1.11.4.js:494:9) at HTMLButtonElement.<anonymous> (Index:250) at HTMLButtonElement.dispatch (jquery-2.1.4.js:4435) at HTMLButtonElement.elemData.handle (jquery-2.1.4.js:4121)
Kindly help me with this
I have created a small sample following your scenario. I have an igGrid with Updating feature enabled. When the "Comment" column is clicked dialog box with text input is opened. This input takes the cell value. When "Save" button is clicked the value of the input is set as cell value.
Attached you will find my sample. Please test it on your side and let me know if it helps you achieve your requirement.
In regards to the exception that you are having, this might happen is the igGrid is instantiated on a "div" element instead of "table" element. More about this can be found here.
Please do not hesitate to contact me if you have any additional questions regarding this matter.
7457.igGridPopup.zip
Thank you for your solution.It is working fine as per my expectation.
Hello Lakshima,
I am glad that you find my suggestion helpful.
Thank you for using Infragistics.