View Full Version : How to add records in json

6 Dec 2013, 3:32 AM
Hello i have some problem.
i have store with:

fields: [
{name: 'id',type: 'int'},
{name: 'name',type: 'string'},
{name: 'author',type: 'string'},
{name: 'year',type: 'string'},
{name: 'price',type: 'string'}, ],

and json json={"id":1,"author":"2","options":[{"name":"NAME","value":"3"},{"author":"american","value":"4"}]}
i have a form with grid (id,name,author,year,price) and button, and when i am click on button a new form show with 5 textfields(id,name,author,year,price)/ This textfields for create new record . And how add a new record.

6 Dec 2013, 5:43 AM
You can use the following options:

var myrec = { name: 'new name'};

// Create a model instance
var rec = Ext.create('Employee', {
name: 'New Guy',
email: '[email protected]',
start: new Date(),
salary: 60000,
active: true

store.insert(0, rec);