Wednesday, 15 April 2015

datagrid - ExtJs refresh of infinite scrolling grid panel -


In my app (ExtJs 4.2.1) I have a unique scrolling grid panel, as well. The user can click on a fresh button, then the rows of the grid should be updated with the data from DB. I call store.load () in the Fresh Button Handler, and my data is updated. This grid works well for the first lines of the panel (record from page 1) but if the user scrolls down the grid, it does not work after Store.load, the grid scrolls the reset position to the top.

I am asking for a solution to reload the store and refresh the grid which also holds the current selection and the current scroll position. Good thing: I have a global index of each record in the store.

This is my code, there are thousands of entries in DB.

Grid Panel:

  Ext.define ('MyApp.view.MyGrid', {extension: 'Ext.grid.Panel', Required: ['Ext.grid.plugin.BufferedRenderer'], aka: 'widget.myGrid', plugins: 'bufferedrenderer', loadMask: true, selModel: {mode: 'Multi', pruneRemoved: false}, itemSelector: 'Div .workspaceItemSelector', overItemCls: 'workspaceItemMouseOver', trackOver: true, auto scroll: true, verticalScroller: {variableRowHeight: true}, defaultSortOrder: 'ASC', // and some column definitions ...});   

Store:

  Ext.define ('MyApp.store.MyStore', {extension: 'Ext.data. Store ', autoLoad: false, buffer: true, pageSize: 100, leadingBufferZone: 100, remoteSort: True, Model:' MyApp.model.MyModel ', storeId:' myStore ', Proxy: {type:' rest ' URL: 'SomeUrl', Reader: {type: 'Jason', total property: 'total', root: 'item'}}});   

is one for unbuffered grids, which does not work for me.

itemprop = "text">

on the load controller function:

  loadStoreFunction: function (grid) {Var storeGrid = grid.getStore (); Var current element = grid.Taset selectionModel (). GetSelection (); StoreGrid.load ({Scope: this, callback: function (record, operations, success) {grid.getView () .focus (); grid.Tets selectionModel (). Select ("Current Element Index"); // Last position. Grid.getSelectionModel () Select (storeGrid.getRange). Length-1); // Insert storeGrid.loadPage (1+ (index / total count), option); // Calculate the page of the loaded line.} }); }    

No comments:

Post a Comment