You can use add (Ext. data. Record [] records) or add (Ext. data. Record record) to add one or more records to the end of the store. For example:
Copy codeThe Code is as follows:
Var newRecord = new PersonRecord ({name: "Tom", age: 22 });
Store. add (newRecord );
The add function adds new data to the end of the store, which may cause damage to the original sorting method. If you want to keep the order, use addSorted to call the same method as add.
You can use the insert method to insert a record to a specified position, for example:
Copy codeThe Code is as follows:
Var newRecord = new PersonRecord ({name: "Tom", age: 22 });
Store. insert (store. getCount (), newRecord );
The remove and removeAll functions can be used for the delete operation, for example:
Copy codeThe Code is as follows:
Store. remove (store. getAt (0 ));
Store. removeAll ();
Modify data in the store:
Copy codeThe Code is as follows:
Store. getAt (0). set ("name", "Jesse ");
After modifying the internal data of a record, you can execute rejectChanges () to undo all the modifications, or submit data modifications through commitChanges.