4月 01, 2020 Sencha
在 ExtJS 內,我們會用 Proxy 來載入 Store 內容。以下是 Proxy 會自動加入的參數 :  
-	start - (number) 像 SQL 的 offset
-	limit - (number) 像 SQL 的 limit
-	page - (number) 頁數
-	sort - (string) JSON format 的字串,用來排列結果

但是有時我們可能需要加入更多的參數才可以抽出資料,那應該要怎樣做呢?

### 動態方法

可以通過使用 `Proxy.setExtraParams()` 來動態設定額外的參數。

```js
grid.getStore().getProxy().setExtraParams({
	foo: 'bar'
});
grid.getStore().load();
```

### 靜態方法

可以通過加入 `extraParams` 到 Proxy 來設定額外的參數。

```js
new Ext.data.Store({
	autoLoad: true,
	proxy: {
		url: 'users.php',
		type: 'ajax',
		extraParams: {
			foo: 'bar'
		}
	}
});
```
過去文章
2025 (9)
4 (5)
3 (1)
2 (3)
2024 (25)
11 (3)
10 (3)
9 (1)
3 (18)
2022 (6)
10 (1)
6 (2)
5 (1)
3 (1)
1 (1)
2021 (21)
11 (7)
7 (1)
6 (2)
5 (2)
4 (6)
3 (2)
2 (1)
2020 (92)
12 (1)
11 (2)
10 (4)
9 (10)
8 (5)
7 (1)
6 (3)
5 (1)
4 (4)
3 (25)
2 (7)
1 (29)
2019 (57)
12 (25)
11 (7)
9 (25)