javascript - creating extjs store data record is failing -


i have error uncaught typeerror: cannot read property 'items' of undefined
following line create neweditinfo type. alert shows there values in arrays have no clue..

getneweditinfo : function () {         var values = {};         var form = this.getform();         var formvalues = form.getvalues();         (var fieldname in formvalues)             values[fieldname] = (formvalues[fieldname] != "") ? formvalues[fieldname] : null;         alert(json.stringify(values));         alert(json.stringify(formvalues));         neweditinfo = ext.data.record.create([{                         name : "id",                         type : "string"                     }, {                         name : "hardwareid",                         type : "string"                     }, {                         name : "location",                         type : "string"                     }, {                         name : "active",                         type : "string"                     }                 ]);          var neweditinfoinstance = new neweditinfo({                 id : values['idfield'],                 hardwareid : values['hardwareidfield'],                 location : values['location '],                 active : values['active']             });         return neweditinfoinstance;     } 

can please?

ext.data.record.create() not return model class new model instance.

firstly should define own model:

ext.define('editinfomodel', {     extend: 'ext.data.model',     fields: [         {             name : "id",             type : "string"         }, {             name : "hardwareid",             type : "string"         }, {             name : "location",             type : "string"         }, {             name : "active",             type : "string"         }     ] }); 

then in getneweditinfo method can create new instance of editinfomodel , set record data ext.create() method:

var neweditinfoinstance = ext.create('editinfomodel', {     id : values['idfield'],     hardwareid : values['hardwareidfield'],     location : values['location '],     active : values['active'] }); 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -