Home > Web Front-end > JS Tutorial > body text

Data access and update issues in ExtJS Store_extjs

WBOY
Release: 2016-05-16 18:28:25
Original
826 people have browsed it

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 code The code is as follows:

var newRecord=new PersonRecord({name:" Tom",age:22});
store.add(newRecord);

The add function will add new data to the end of the store, which may change the original sorting method. Cause damage, if you want to keep order, you should use addSorted, the calling method is the same as add.
You can use the insert method to insert a record into a specified location, such as:
Copy code The code is as follows:

var newRecord=new PersonRecord({name:"Tom",age:22});
store.insert(store.getCount(),newRecord);

Delete Operations can use the remove and removeAll functions, such as:
Copy code The code is as follows:

store. remove(store.getAt(0));
store.removeAll();

Modify the data in the store:
Copy Code The code is as follows:

store.getAt(0).set("name","Jesse");

Modification After recording the internal data, you can undo all modifications by executing rejectChanges(), or commit data modifications by commitChanges.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!