Data access and update of ExtJS Store

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.