Unable to set function to the kendo observable on Grid Edit event

1 Answer 41 Views
Button General Discussions Grid
Renu
Top achievements
Rank 1
Iron
Iron
Iron
Renu asked on 16 Oct 2024, 11:20 AM | edited on 16 Oct 2024, 11:21 AM

I have a function as 

function () {
return this.get('inputTextvalue') && this.get('inputTextvalue').trim();
}

I want to set to the kendo Observable:
var ko = kendo.observable({
    onEdit: function (e) {
        $(function () {


            var ds= e.container.find('.k-grid').data('kendoGrid').dataSource,
            model.set('inputTextvalue', null);

            model.set('btnEnabled', function () {
             return this.get('inputTextvalue') && this.get('inputTextvalue').trim();
            });
            dataSource.data(model.Data);
        });
    }
});


I'm getting error as 
Uncaught SyntaxError: "undefined" is not valid JSON
    at JSON.parse (<anonymous>)
    at init._change (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:125534)
    at init.trigger (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:4180)
    at init.<anonymous> (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:83206)
    at init.trigger (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:4180)
    at init.set (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:88287)
    at init.set (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:90491)
    at init.onEdit (<anonymous>:14:29)
    at init.<anonymous> (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:168524)
    at init.trigger (kendo?v=Ap0ariFxbPaGlnYj11dqmTEGSRA:10:4180)

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 21 Oct 2024, 07:22 AM

Hello, Revathi,

Could you modify this Dojo example so that I can see the error you are getting? I will then be able to investigate.

Looking forward to your reply.

Regards,
Martin
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Renu
Top achievements
Rank 1
Iron
Iron
Iron
commented on 25 Oct 2024, 09:40 AM | edited

I have added a function to the model using set -> example
E
arlier i was using 2022.3.606 version did not face any issue. Recently upgraded to 2024.3.806 version. I'm getting this undefined error.. 
Martin
Telerik team
commented on 04 Nov 2024, 07:53 AM

Hello, Revathi,

In the onEdit function, you are trying to use the set method on a field that is not present in the e.model object. In the modified example, you will see that the error is not being raised. Kindly review the code in the onEdit event to use a field that exists in the model.

Tags
Button General Discussions Grid
Asked by
Renu
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Martin
Telerik team
Share this question
or