This is a migrated thread and some comments may be shown as answers.

Database data syncing

2 Answers 135 Views
Application
This is a migrated thread and some comments may be shown as answers.
Rugved
Top achievements
Rank 1
Rugved asked on 13 Jun 2016, 07:20 AM

Hi,

I just started to work on this platform last week.

I have created a table and want to add data to it on submit button click.My table name is Doctor. The data is not syncing to table i guess.This is my code .Api key is not mentioned for obvious reason.Also whenever I logout all the changes made in code disappears.I am really new to this platform so please help me out.

app.formView = kendo.observable({
    onShow: function() {},
    afterShow: function() {}
});

// START_CUSTOM_CODE_formView
// Add custom code here. For more information about custom code, see http://docs.telerik.com/platform/screenbuilder/troubleshooting/how-to-keep-custom-code-changes
 
// END_CUSTOM_CODE_formView
(function(parent) {
   var apiKey="";
     var el = new Everlive(apiKey);
     var doc=new kendo.data.DataSource({
          type: "everlive",
         transport: {
            typeName: "Doctor"
        }
     });
    var formViewModel = kendo.observable({
        
        fields: {
            city: '',
            state: '',
            address2: '',
            address1: '',
        },
        submit: function() {
            var add1=$("#add1").val();
             var state=$("#state").val();
             var city =$("#city").val();
            if(add1=="")
                {
                $("#adderr").show();
                    return false;
            }
            if(state==null){
                $("#stateerr").show();
                  return false;
            }
            if(city==""){
                $("#cityerr").show();
 return false;
            }
            
           doc.add({
               Address1:formViewModel.fields.address1,
               City:formViewModel.fields.city,
               State:formViewModel.fields.state
              
           });
           doc.one("sync",this.close);
            doc.sync();
            alert("hello");
            

            

        },
        cancel: function() {}
    });

    parent.set('formViewModel', formViewModel);
})(app.formView);

Thanks, 

Rugved

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimiter Topalov
Telerik team
answered on 15 Jun 2016, 07:05 AM
Hello Rugved,

The dataSource.schema needs to be configured:

http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema

http://docs.telerik.com/kendo-ui/framework/datasource/crud#schema

http://dojo.telerik.com/OSore

I have prepared a simple example (the Grid is for displaying the data only):

http://dojo.telerik.com/OSore

I hope this helps.

Regards,
Dimiter Topalov
Telerik
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
0
Rugved
Top achievements
Rank 1
answered on 16 Jun 2016, 11:59 AM
Thank you it worked.....
Tags
Application
Asked by
Rugved
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Rugved
Top achievements
Rank 1
Share this question
or