Extjs网格-无当前页面
并在此问题上提前感谢您的帮助 我有一个ExtJS4.1网格,由从服务器加载的json填充。分页是远程的,每一大块的25项都作为有效的json从服务器上正确地提供,并在totalProperty中具有正确的值。就加载和分页而言,所有功能都可以正常工作,分页栏中没有页码。 看起来像这样。 好的…我不允许发布图片…这里有一个链接 这是相关代码。如果有助于排除故障,我可以发布其他代码Extjs网格-无当前页面,extjs,grid,paging,extjs4.1,Extjs,Grid,Paging,Extjs4.1,并在此问题上提前感谢您的帮助 我有一个ExtJS4.1网格,由从服务器加载的json填充。分页是远程的,每一大块的25项都作为有效的json从服务器上正确地提供,并在totalProperty中具有正确的值。就加载和分页而言,所有功能都可以正常工作,分页栏中没有页码。 看起来像这样。 好的…我不允许发布图片…这里有一个链接 这是相关代码。如果有助于排除故障,我可以发布其他代码 var theStore = Ext.create('Ext.data.Store', { m
var theStore = Ext.create('Ext.data.Store',
{
model: 'SearchResult',
pageSize: 25,
remoteSort: true,
proxy:
{
type: 'ajax',
url: '/Search/SubmitSimpleQuery',
reader:
{
type: 'json',
root: 'Results',
totalProperty: 'totalHits'
},
extraParams:
{
searchText: theSearchText,
beginDate: theBeginDate,
endDate:theEndDate,
collectionMatch:theCollection
}
}
});
theStore.load();
var grid = Ext.create('Ext.grid.Panel',
{
store: theStore,
width: '100%',
height: '100%',
columns:
[
{
text: 'Title',
dataIndex: 'title',
width: '60%'
},
{
text: 'Published Date',
dataIndex: 'pubDate_ymd',
renderer: renderDate
},
{
text: 'Released Date',
dataIndex: 'releaseDate_ymd',
renderer: renderDate
},
{
text: 'From',
dataIndex: 'from',
hidden: true
},
{
text: 'To',
dataIndex: 'to',
hidden: true
}
],
dockedItems: [
{
xtype: 'pagingtoolbar',
dock: 'bottom',
store: theStore,
displayInfo: true,
displayMsg: 'Displaying results {0} - {1} of {2}',
emptyMsg: 'No results'
}]
});
Ext.create('Ext.panel.Panel',
{
bodyPadding:25,
width:'100%',
renderTo:Ext.getBody(),
items:[
grid
]
});
totalproperty是通过json正确地输入的-例如108,结果是5页。所有的传呼工作。当分页到第2页时,page:2、start:25、limit:25都会传递给服务器,因此ext知道它是什么页面,但不会进入当前页面框。然后我是否需要将该页值设置为代理或存储上的属性
我被难住了,我一直在用头撞这个
谢谢
顺便说一句,
这是一个类似的问题
但是(显然)已经修复了将分页条添加到网格上的dockeditems中的问题,正如您在上面看到的那样。来自Sencha API文档:
要使用分页,需要在存储上设置pageSize配置,
并在存储首次启动时将分页要求传递给服务器
上膛了
我认为您的问题可能是在没有任何此类参数的情况下手动调用存储.load()
。我认为你根本不需要这样称呼它。这是一个检查的好主意。我在商店里设置了页面大小。我刚刚检查了分页要求,它们会自动发送到服务器。因此,在初始加载页面=1,开始=0和限制=25都被正确发送。(explicit store.load更多地是调试和尝试更好地隔离事物的结果,很遗憾,自动加载也不起作用)您是否检查了页面上的元素以验证值
属性是否为空?在图中,输入字段的样式看起来很奇怪,可能是因为该值在视图中被遮挡了?
store.load({
params: {
// specify params for the first page load if using paging
start: 0,
limit: myPageSize,
// other params
foo: 'bar'
}
});