2010-11-11 67 views
0

当我从最后一页删除最终记录时,我得到分页问题,​​如何解决分页问题,​​请查看我附加的屏幕截图。Extjs Grid分页栏问题

alt text

在商店节省事件中,我将刷新商店更新远程排序电网。

这样

var fGridStore = new Ext.data.Store({  
    proxy:ApGrpFGrdProxy,      
    autoLoad :false, 
    autoSave:false, 
    idProperty:'airBasicIndex', 
    baseParams:{start:0, limit:25}, 
    reader:firstGridreader, 
    writer: fssuperGrdWriter, 
    listeners:{ 

       save :function (St, records, options){ 
        St.reload();       
        } 
     }, 
    remoteSort:true 
}); 

在电网..

bbar: new Ext.PagingToolbar({ 
        pageSize: 25, 
        store: fGridStore, 
        displayInfo: true,      
        emptyMsg: "No records to display" 
       }), 

如果您查看我的屏幕截图.. 4 5将是当我删除最后一页的最后一条记录的页面。 。当我删除最后一页中的最后一条记录时,我可以移到上一页。

在此先感谢

回答

1

您是否尝试过使用工具栏上的moveLast()方法来为导航去最后一页?

API Docs for PagingToolbar.moveLast()

+0

喜“这咕噜” thnk乌拉圭回合的答复,我们将如何识别它是在最后一页..then只有我觉得可以用这个method..else它总会移动到最后的最后一个记录所有删除事件的页面.....是正确的还是可以解决的? – vineth 2010-11-12 08:08:47

+0

这应该起作用,因为您要移至包含上次事件的页面。正如前面的答案中所建议的那样,您应该使用Ext.data.Store.getTotalCount()来查看在转到工具栏上最后一页之前存储中的记录总数。 – 2010-11-15 16:27:54

0

我认为,在这种情况下,最好的做法是返回总行数与每个请求。 您应在删除操作后重新加载商店。 然后您可以配置您的阅读器使用总行数。 然后问题会自动消失。 请参阅Ext.data.JsonReader API Doc。

var myReader = new 
Ext.data.JsonReader({ 
// metadata configuration options: 
idProperty: 'id' 
root: 'rows', 
totalProperty: 'results', 
Ext.data.DataReader.messageProperty: 
"msg" // The element within the 
response that provides a user-feedback 
message (optional) 

    // the fields config option will internally create an Ext.data.Record 
    // constructor that provides mapping for reading the record data 
objects 
    fields: [ 
     // map Record's 'firstname' field to data object's key of same 
name 
     {name: 'name'}, 
     // map Record's 'job' field to data object's 'occupation' key 
     {name: 'job', mapping: 'occupation'} 
    ] }); 
+0

喜user506212,我有totalProperty在读者看起来像 – vineth 2010-11-15 13:39:50

+0

读者:新Ext.data.JsonReader({ 根: '水库', ID: 'HJid', idProperty: 'arOpDefIndex', totalProperty: 'TOTALCOUNT', successProperty:'success', messageProperty:'message', fields:fields }), – vineth 2010-11-15 14:27:26