Database data syncing

3 posts, 1 answers
  1. Rugved
    Rugved avatar
    3 posts
    Member since:
    Jun 2016

    Posted 13 Jun 2016 Link to this post

    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. Answer
    Dimiter Topalov
    Admin
    Dimiter Topalov avatar
    569 posts

    Posted 15 Jun 2016 Link to this post

    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.
  3. Rugved
    Rugved avatar
    3 posts
    Member since:
    Jun 2016

    Posted 16 Jun 2016 in reply to Dimiter Topalov Link to this post

    Thank you it worked.....
Back to Top