PDA

View Full Version : Proper way to add/remove rows from Grid when using PagingScroller?



JakeL
13 Mar 2012, 2:16 PM
Hi All -

I'm trying to combine functionality from examples I've found on Sencha's site: adding/removing rows, and the PagingScroller. I'm having funny behavior when I try to add a new row (new record to the store), and removing rows (remove record from store).

The store gets populated, and then from the "Buffer Grid" example:



prStore.cacheRecords(records);
prStore.guaranteeRange(0, prStore.pageSize-1);


This works well.

However, when I try to add new rows, the behavior is odd. I'm sure this is related to the PagingScroller and the caching involved, since the adding/removing works well when the PagingScroller is removed:

Add:



// Create a model instance
var pr = Ext.create('PartReplacement');
prStore.add(pr);
var count = prStore.count();
cellEditing.startEditByPosition({ row: count - 1, column: 0 });


Remove:



var cell = prSheet.getSelectionModel().getCurrentPosition();
//alert("removing row:" + cell.row);
prStore.removeAt(cell.row);



Can you fill me in on what I need to be telling the store or the paging scroller to have this behave correctly?

Cheers,

-Jake