以下で説明するdojox.grid.EnhancedGrid
class によって作成されたものを使用しています。MyGrid
var MyGrid = declare(null, {
constructor: function (app, id, opts) {
this.id = id;
this.app = app;
this.core_id = app.getCoreId();
var myStore;
var jquery = {
scope: 'core',
command: 'rest',
args: {
resource: this.id,
serve: 'cooked'
},
core_id: this.core_id
};
this.jsonStore = new custom.store.JsonRest({
target: app.get_dispatcher_url(),
jquery: jquery,
// setstruct is an object to provide a method that sets a new
// grid structure as soon as data arrives.
set_structure: dojo.hitch(this, this.set_structure),
app: this.app
});
// avoid closures from holding a reference
// to jquery and preventing its GCing
jquery = null;
this.memoryStore = new Memory();
myStore = new Cache(this.jsonStore, this.memoryStore);
this.dataStore = new ObjectStore({
objectStore: myStore,
onSet: onEdited,
onNew: onEdited,
onDelete: onEdited
});
myStore = null;
// create grid
this.grid = new EnhancedGrid({
store: this.dataStore,
height: '100%',
structure: [
{ name: 'Waiting for data...', field: 'no-field', width: '10em' }
],
plugins: {
menus: { rowMenu: this._create_menu() },
nestedSorting: true,
selector: { row: 'disabled', col: 'disabled', cell: 'multi' }
}
});
// start grid
this.grid.startup();
}
});
「グリッド/ストア」の作成だけに集中するためにコードを省略したことに注意してください。MyGrid
ContentPane にグリッドを表示します。
そこで、(大量のデータを含む) グリッドを表示し、一番下までスクロールするオブジェクトを作成すると、表示されている行のみが適切に要求されます。ただし、2 番目のグリッドを作成すると、2 番目のグリッドのコンテンツと最初のグリッドのすべてのデータが要求されます。
これはどのように起こりますか?これを引き起こしている可能性のあるものについて何か考えはありますか?
編集済み (22/02/13):
私が得ている問題を示すためにjsfiddleを作成しました:jsfiddleを参照してください
問題を再現する方法:
- [新しいタブ] ボタンをクリックしてコンソールを開き、フェッチされた行数を確認します。
- グリッドの一番下に (すばやく) 移動し、コンソールをもう一度確認します。
- 新しいタブをもう一度クリックしてコンソールに移動すると、前のグリッドからまだロードされていないすべての行がフェッチされたことがわかります。
注:これはGoogle Chromeでのみ発生することがわかりました。Firefoxでテストしたところ、すべてうまくいきました。