본문 바로가기

웹 개발/extjs4

extjs grid dataStore onLoad 처리.

extjs grid에서 dataStore를 모두 불러왔을때 이벤트 처리를 해야할 경우가 생겼다.

이전의 삽질을 바탕으로 listener를 먼저 생각했고, 이벤트는 onLoad, afterLoad 등 하다가 단순하게 load를 하니 작동한다.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// create the Data Store
    store = Ext.create('Ext.data.Store', {
        pageSize: 20,
        model: 'QnA',
        //remoteSort: true,
        proxy: new Ext.data.HttpProxy({
            extraParams : jQuery('form[name="searchForm"]').formParams(),
            url: REMOTE_URL,
            reader: new Ext.data.JsonReader(
        { root: 'datas', totalProperty: 'totalCount'}
    )}
        ),
        listeners: {
            load: function(dataStore, rows, bool) {
                console.log(dataStore);
                console.log(rows);
                console.log(bool);
            },
            scope: this
        }
    });