Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
[object Object] displayed on cell edit
posted

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]

Parents Reply
  • 640
    Offline posted in reply to Satish Kumar

    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 Kombov
    Entry Level Software Developer
    Infragistics, Inc.

Children
No Data