简体   繁体   中英

Updating a Store record value in sencha touch 2

I have a store and have populated with 5 records. the corresponding model has 6 fields : ordinal, pageNum, top, left, bottom , right. When i try to update the 4 fields those are top, left, bottom , right for the particular record, lets say i want to update fields(top, left, bottom , right) in the 4 th record and i am setting the record to dirty :

 markukRecord = markupStore.getAt(3)
 markupRecord.set('top',topVal);
 markupRecord.dirty = true;

 markukRecord = markupStore.getAt(3)
 markupRecord.set('left',leftVal);
 markupRecord.dirty = true;

 markukRecord = markupStore.getAt(3)
 markupRecord.set('bottom',botVal);
 markupRecord.dirty = true;

 markukRecord = markupStore.getAt(3)
 markupRecord.set('right',rightVal);
 markupRecord.dirty = true;

note: the code is not repeated, its running through the loop. the problem here is , the 'left' and 'right' values are updated to the 5th record but not to the 4th record(index=3).

Am i missing anything here? Thanks in advance.

Seems very weird that if you're iterating only one item does not get saved... should be the same code for all items..

One thing that you should check: are you doing markupStore.sync() after doing those changes?

Maybe you should show us the complete code, for example, where are `leftVal or rightVal defined? how are they defined, etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM