全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1333
推到 Plurk!
推到 Facebook!

ListView 使用 LiveBindings 顯示超過 200 條記錄?

答題得分者是:aftcast
bear28
一般會員


發表:44
回覆:53
積分:19
註冊:2002-09-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2015-06-16 17:17:59 IP:101.11.xxx.xxx 訂閱
ListView 使用 LiveBindings 預設載入 200 條記錄,這也許是速度的考量,但當需要全部載入的的情況時,該如何做呢?只需加入下面二行代碼即可:

FDQuery1.OptionsIntf.FetchOptions.RecsMax := -1;
FDQuery1.OptionsIntf.FetchOptions.AutoFetchAll := afAll;
ps. 以上實測載入七萬條記錄,在 Windows 7 約要十幾秒的時間。

這是從龜山阿卍看到的資訊,非常感謝龜山阿卍.但測試後有些不懂

請問這兩行要加至何處?
在FDQuery1下FetchOptions屬性中預設已經是RecsMax := -1,AutoFetchAll := afAll.
與這兩行
FDQuery1.OptionsIntf.FetchOptions.RecsMax := -1;
FDQuery1.OptionsIntf.FetchOptions.AutoFetchAll := afAll;
有不同嗎?
謝謝
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#2 引用回覆 回覆 發表時間:2015-06-18 00:17:59 IP:61.223.xxx.xxx 未訂閱
沒有不同!
就好像在 fdquery 的 properity 中下 SQL = xxxxx
與在程式中下 fdquery.sql.text:= 'xxxx'
都是一樣的啊!
bear28
一般會員


發表:44
回覆:53
積分:19
註冊:2002-09-10

發送簡訊給我
#3 引用回覆 回覆 發表時間:2015-06-18 16:24:21 IP:49.218.xxx.xxx 訂閱
但無法讓listview顯示超過200筆資料,那有辦法超過200筆嗎,謝謝
===================引 用 P.D. 文 章===================
沒有不同!
就好像在 fdquery 的 properity 中下 SQL = xxxxx
與在程式中下 fdquery.sql.text:= 'xxxx'
都是一樣的啊!
aftcast
站務副站長


發表:81
回覆:1485
積分:1763
註冊:2002-11-21

發送簡訊給我
#4 引用回覆 回覆 發表時間:2015-06-18 17:15:17 IP:114.32.xxx.xxx 訂閱
http://docwiki.embarcadero.com/Libraries/XE8/en/Data.Bind.Components.TCustomBindList.BufferCount

A value of -1 indicates that the source component uses its default buffer count. For a source component of TBindScopeDB, the default buffer count is 200. Set BufferCount to a higher number in order to display more rows in the grid component.
------


蕭沖
--All ideas are worthless unless implemented--

C++ Builder Delphi Taiwan G+ 社群
http://bit.ly/cbtaiwan
bear28
一般會員


發表:44
回覆:53
積分:19
註冊:2002-09-10

發送簡訊給我
#5 引用回覆 回覆 發表時間:2015-06-18 18:02:35 IP:101.13.xxx.xxx 訂閱
謝謝...
===================引 用 aftcast 文 章===================
http://docwiki.embarcadero.com/Libraries/XE8/en/Data.Bind.Components.TCustomBindList.BufferCount

A value of -1 indicates that the source component uses its default buffer count. For a source component of TBindScopeDB, the default buffer count is 200. Set BufferCount to a higher number in order to display more rows in the grid component.
P.D.
版主


發表:603
回覆:4038
積分:3874
註冊:2006-10-31

發送簡訊給我
#6 引用回覆 回覆 發表時間:2015-06-19 00:46:15 IP:1.165.xxx.xxx 未訂閱
剛才查了一下uses, 這兩種寫法分別來自

FireDAC.Comp.Client (這行是 query 下直接呼叫 option的)
FireDAC.Stan.Option (這行是阿卍前輩的)
不過, 接下來的source 就超出我的認知範圍了, 無法給你解釋是否兩邊下法會是一致的結果,
所以就照阿卍的下下看, 試試看下在 connect 之前, 既然有po出解法, 應該是可以的,
但在Deivce上要存那麼多筆記錄, 恐怕手機不死也半條命了吧!

而我實際操作的經驗(我是用fdtable), 透過 Datasnap 抓取後端資料庫到1000筆, 顯示到ListView(也是用Live/biding), 並沒有只出現200筆的問題
編輯記錄
P.D. 重新編輯於 2015-06-19 00:48:40, 註解 無‧
系統時間:2024-04-25 0:12:30
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!