MVVM datasource jQuery input stoped working after upgrade

1 Answer 23 Views
MVVM
Gunnar
Top achievements
Rank 1
Iron
Gunnar asked on 05 Mar 2025, 09:16 AM | edited on 05 Mar 2025, 09:16 AM

Hello,

we recently upgraded from Kendoui 2022 to the latest version and our MVVM forms stoped working.

So either there are changes to the datasource or MVVM or both.

Any ideas how to fix it?

The input elements look like this:
<input  data-bind="value: emailTextSource.data()[0].siteGroup" name="siteGroup" id="siteGroup" value="" class=" form-control" />

Here is the datasource and the binding:
<script>
	var crudServiceBaseUrl = 'emailTexts';
	var myData = new kendo.data.DataSource({
        transport: {
            read: {
                url: crudServiceBaseUrl + "/getdetails?id=1",
                dataType: "json"
            },
            update: {
                url: crudServiceBaseUrl + "/updatedetails",
                dataType: "json",
                type: 'get'
            },
            destroy: {
                url: crudServiceBaseUrl + "/destroydetails",
                dataType: "json"
            },
        },
        schema: {
            model: {
                id: "id",
                fields: {
                	    }
            }
        }
    });
	var viewModel = kendo.observable({
    	emailTextSource: myData,
		language: [{"language":1,"text":"Deutsch","logger":"","wirebox":"","languageId":1,"id":1,"validationResult":""},{"language":1,"text":"Englisch","logger":"","wirebox":"","languageId":2,"id":3,"validationResult":""}], delete: function(e) {
			if (confirm('Sind Sie sicher?')) {
			    this.emailTextSource.remove(this.emailTextSource.data()[0]);
				this.emailTextSource.sync();
			} else {
			    // Do nothing!
			}
		}
		, save: function(e) {
			if (confirm('Speichern?')) {
				myData.sync();
			} else {
			    // Do nothing!
			}
		}
		
	});
	kendo.bind($("#emailTextDiv"), viewModel);
	myData.read();

</script>

1 Answer, 1 is accepted

Sort by
0
Accepted
Gunnar
Top achievements
Rank 1
Iron
answered on 05 Mar 2025, 11:38 AM

ok, I fixed it:


<input  data-bind="value: emailTextSource.siteGroup" name="siteGroup" id="siteGroup" value="" class=" form-control" />


    myData.fetch(function(){
        viewModel.set('emailTextSource',myData.data()[0]);
    });

Tags
MVVM
Asked by
Gunnar
Top achievements
Rank 1
Iron
Answers by
Gunnar
Top achievements
Rank 1
Iron
Share this question
or