above image is how the data is and we have enabled cell editing. Now when we double click [object Object] is being displayed, how can we bind it with previous data and then update rather showing [object Object]
Hello Satish,
Thank you for your patience while I was looking into this matter for you.
I have created a small sample demonstrating how your requirement could be achieved by using the Custom Editor Provider feature of igGrid and handling the editCellEnding event of the igGridUpdating feature:
{ name: "Updating", ... columnSettings: [ { columnKey: "Category", editorProvider: new $.ig.EditorProviderInput() } ] } $.ig.EditorProviderInput = $.ig.EditorProviderInput || $.ig.EditorProvider.extend({ ... setValue: function (val) { if (val !== null && typeof val !== 'string') { this.editor.element.val(val.Name); } else { this.editor.element.val(val); } } ... });
{ name: "Updating", ... editCellEnding: function (evt, ui) { var record = $("#grid").igGrid("findRecordByKey", ui.rowID); if (ui.columnKey === 'Category') { if (!ui.rowAdding) { ui.value = { ID: record.Category.ID, Name: ui.value } } else { ui.value = { ID: Date.now() + Math.random(), Name: ui.value } } } } ... }
More information regarding the Custom Editor Provider feature you can find here.
Please test the sample on your side and let me know whether you find it helpful.
Looking forward to hearing from you.
Regards,Viktor KombovEntry Level Software DeveloperInfragistics, Inc.
Thank you for getting back to me.
I am currently looking into this matter for you. I will keep you posted on my progress and I will get back to you as soon as possible with more information or questions for you.
Please feel free to continue sending updates to this case at any time.
Hello Viktor,
Thank you for you feedback earlier but what we are looking for is how can we handle with text editor rather using igcombo because our requirement is something like updating description which cannot be a combo it has to text..
thanks,
Satish
If the value that you are trying to edit is object, you should use an editor that can handle complex object. I believe you will find the Data Grid - Handling Complex Objects sample very helpful. There is demonstrated how you can use the igCombo control as an editor for columns with dataType "object":
// dataSource for the combo editor var northWindCategoriesJSON = [ { "ID": 0, "Name": "Food" }, { "ID": 1, "Name": "Beverages" }, { "ID": 2, "Name": "Electronics" } ]; $("#grid").igGrid({ ... columns: [ ... { headerText: "Category", key: "Category", dataType: "object", mapper: function (record) { return record.Category.Name; } } ], features: [ ... { name: "Updating", editMode: "cell", columnSettings: [ { columnKey: "Category", editorType: "combo", editorOptions: { dataSource: northWindCategoriesJSON, textKey: "Name", valueKey: "ID", mode: "dropdown" } } ] } ] });
Additionally, here you can find more detailed information regarding how to handle complex data extraction from complex objects.
Please let me know if you need any further assistance regarding this matter.
In the sample you shared, datatype is either string, numeric or date. I our case it is Object.
Can you try to reproduce with Object as datatype.
Thanks,