不好意思...
小妹我又來打饒大家了~
我遇到一個困饒~
在grid的pagingToolbar我大概知道不支持本地分頁...
可以請問一下(已有上網查過...不過還是不太懂):
1)我在pagingToolbar的store的proxy設置一個url:'data/users.json',所以是本地數據,自己電腦的數據,這樣的意思嗎?而他給我們的example,url設置為url: 'http://www.sencha.com/forum/topics-browse-remote.php',所以是在網路上的,叫遠端數據?那如果有一天自己要開個網站,那不就url都要設置成別人的網站嗎?頭腦有點混亂...可以請教一下各位前輩,本地分頁(數據)的意思是?遠端數據是?謝謝大家> <~(我很怕自己問一個蠢問題!!)
在grid的PagingScroller我不了解的是...
2)下面我有用紅字凸顯問題,註:這是我自己寫的範例...因為官網上的範例掛掉了...
/**
* @example Paging Toolbar
*
* This example demonstrates loading data in pages dynamically from the server using a {@link Ext.toolbar.Paging Paging Toolbar}.
* Note, that since there is no back end (data is loaded from a static file at `data/users.json`) each page will show the same data set.
*/
Ext.require('Ext.data.Store');
Ext.require('Ext.grid.Panel');
Ext.require('Ext.grid.PagingScroller');
Ext.define('User', {
extend: 'Ext.data.Model',
fields: [ 'name', 'email', 'phone' ]
});
Ext.onReady(function() {
var userStore = Ext.create('Ext.data.Store', {
model: 'User',
autoLoad: true,
pageSize: 12,//在pagingScroller裡pageSize的功用??
proxy: {
type: 'ajax',
url : 'data/users.json',
reader: {
type: 'json',
root: 'users',
totalProperty: 'total'
}
}
});
Ext.create('Ext.grid.Panel', {
renderTo: Ext.getBody(),
store: userStore,
// Use a PagingGridScroller (this is interchangeable with a PagingToolbar) //←這是他的註解
verticalScrollerType: 'paginggridscroller', //verticalScrollerType在Ext4.0.2a的API裡找不到,代表他不是保留字,我也試過自己亂改,scroller仍可以顯現,那怎麼知道啥時要寫這個verticalScrollerType?但paginggridscroller這個卻是保留字...混亂...
// do not reset the scrollbar when the view refreshs //←這是他的註解
invalidateScrollerOnRefresh: false, //這個功用是什麼?改成true和false結果好像都一樣...自己有試過,好像不像他註解解釋的那樣
// infinite scrolling does not support selection //←這是他的註解
disableSelection: true, //這個功用是什麼?改成true和false結果好像都一樣...自己有試過,好像不像他註解解釋的那樣
width: 400,
height: 220,
title: 'Application Users',
columns: [
{
text: 'Name',
width: 100,
dataIndex: 'name'
},
{
text: 'Email Address',
width: 150,
dataIndex: 'email'
},
{
text: 'Phone Number',
flex: 1,
dataIndex: 'phone'
}
]
});
});
謝謝大家...