ember.js - How to update record in local storage using ember data and localstorage adapter? -


i new emberjs , making 1 simple crud application. using ember data , localstorage-adapter save record in local storage of browser.

i trying update record using localstorage-adapter throwing error.

i have listed code here :

updatecontact: function(){//save data in local storage         var fname = this.obj_form_edit_data.get('cont_data.fname');         var lname = this.get('cont_data.lname');         var email = this.get('cont_data.email');         var contactno = this.get('cont_data.contactno');         var gendertype = ((this.get('ismale') == true) ? true : false);         var contactype = $(".selectpicker").val();         grid.modalmodel.updaterecords({            fname: fname,           lname: lname,           email: email,           contactno: contactno,           gendertype: gendertype,           contactype: contactype         });         this.get('store').commit();                  } 

i getting following error using above code :

uncaught typeerror: object function () { if (!wasapplied) {   class.proto(); // prepare prototype... } o_defineproperty(this, guid_key, undefineddescriptor); o_defineproperty(this, '_super', undefineddescriptor); var m = meta(this); m.proto = this; if (initmixins) {   // capture locally can clear closed on variable   var mixins = initmixins;   initmixins = null;   this.reopen.apply(this, mixins); } if (initproperties) {   // capture locally can clear closed on variable   var props = initproperties;   initproperties = null;    var concatenatedproperties = this.concatenatedproperties;    (var = 0, l = props.length; < l; i++) {     var properties = props[i];      ember.assert("ember.object.create no longer supports mixing in other definitions, use createwithmixins instead.", !(properties instanceof ember.mixin));      (var keyname in properties) {       if (!properties.hasownproperty(keyname)) { continue; }        var value = properties[keyname],           is_binding = ember.is_binding;        if (is_binding.test(keyname)) {         var bindings = m.bindings;         if (!bindings) {           bindings = m.bindings = {};         } else if (!m.hasownproperty('bindings')) {           bindings = m.bindings = o_create(m.bindings);         }         bindings[keyname] = value;       }        var desc = m.descs[keyname];        ember.assert("ember.object.create no longer supports defining computed properties.", !(value instanceof ember.computedproperty));       ember.assert("ember.object.create no longer supports defining methods call _super.", !(typeof value === 'function' && value.tostring().indexof('._super') !== -1));        if (concatenatedproperties && indexof(concatenatedproperties, keyname) >= 0) {         var basevalue = this[keyname];          if (basevalue) {           if ('function' === typeof basevalue.concat) {             value = basevalue.concat(value);           } else {             value = ember.makearray(basevalue).concat(value);           }         } else {           value = ember.makearray(value);         }       }        if (desc) {         desc.set(this, keyname, value);       } else {         if (typeof this.setunknownproperty === 'function' && !(keyname in this)) {           this.setunknownproperty(keyname, value);         } else if (mandatory_setter) {           ember.defineproperty(this, keyname, null, value); // setup mandatory setter         } else {           this[keyname] = value;         }       }     }   } } finishpartial(this, m); delete m.proto; finishchains(this); this.init.apply(this, arguments); 

} has no method 'updaterecords'

i using following code create new record working fine :

savecontact: function(){//save data in local storage         var fname = this.obj_form_edit_data.get('cont_data.fname');         var lname = this.obj_form_edit_data.get('cont_data.lname');         var email = this.obj_form_edit_data.get('cont_data.email');         var contactno = this.obj_form_edit_data.get('cont_data.contactno');         var gendertype = ((this.get('ismale') == true) ? true : false);         var contactype = $(".selectpicker").text();         grid.modalmodel.createrecord({             fname: fname,           lname: lname,           email: email,           contactno: contactno,           gendertype: gendertype,           contactype: contactype         });         this.get('store').commit();      } 

you're using updaterecords plural, should updaterecord


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -