1. 개별화면에서 처리

...
        <sc-grid id="gridPanel"
                 data-provider="{{resultList}}"
                 class="flex"
                 editable="false"
                 show-tooltip="true"
                 use-state="false"
                 use-selection="true"
                 locked-column-count="0"
                 selection-able-function="onSelectionAble"
                 on-header-click="onHeaderClick"
                 on-item-click="onItemClick">
...
...
            onResponse : function(event)
            {
                var me = this;
                var _result = event.target.lastResponse;
                
                switch (event.target.id)
                {
                    case "selRFQList" :
                        me.set("resultList", _result);

                        // Move focus to the clicked Row.
                        if (UT.isNotEmpty(me.clickedItem) && me.resultList.length > 0)
                        {
                            setTimeout(function()
                            {
                                me.$.gridPanel.setCurrentCell({dataField:me.clickedItem.dataField, rowIndex:me.clickedItem.rowIndex});
                                
                                me.clickedItem = null;
                            }, 500);
                        }
                        me.applyFormula();
                        break;

...

            onItemClick : function(event)
            {
                var me = this;
                var data = event.detail.data;
                var item = event.detail.item;
                var provider = event.detail.provider;
                
                switch (item.dataField)
                {
                    case "rfq_no" :
                        if (UT.isNotEmpty(data[item.dataField]))
                        {
                            me.clickedItem = item;
                            me.fire("show-detail", data);
                        }
                        break;
...

 

2. 개별화면에서 처리(paging처리시)

                <!-- Paging -->
                <sc-grid-paging id="gridPaging"
                                url="findApprList.do" 
                                body="{{searchParam}}"
                                page-size-items="100, 200, 300, 400, 500, 1000"
                                default-page-index="4"
                                on-error="onPageLoadError"
                                on-response="onPageResponse"
                                on-page-load-completed="onPageLoadCompleted">
                </sc-grid-paging>
            </sc-grid>
.....
        onItemClick : function(event)
        {
            var me = this;
            var data = event.detail.data;
            var item = event.detail.item;
            var provider = event.detail.provider;
            
            switch (item.dataField)
            {
                case "appr_no" :
                    ...
                    // 선택한 컬럼정보 보관
                    me.clickedCell = {data:data, item:item};
                    break;

                default :
                    break;
            }
        },


....


        onPageLoadCompleted : function(event)
        {
            var me = this;
            var _resultList = event.detail.content;
            var _grid = event.target.getGrid();
            
            // Move focus to the clicked Row.
            if (UT.isNotEmpty(me.clickedCell) && _resultList.length > 0)
            {
                var _item = me.clickedCell.item;
                var _data = me.clickedCell.data;
                
                var _cell = _grid.searchItem(_item.dataField, _data.appr_no, 0);

                setTimeout(function()
                {
                    if (UT.isNotEmpty(_cell))
                    {
                        _grid.setCurrentCell({dataField:_cell.fieldName, rowIndex:_cell.itemIndex});
                    }
                    
                    me.clickedCell = null;
                }, 500);
            }
        },

 

3. cc-grid-toolbar.html에서 통합처리

...
            attached : function(){
                if(!this._attachedCalled) {
                    this._attachedCalled = true;
                    //한번만 호출되도록 로직작성
                    
                    var me = this;
                    if(me.scGrid.gridBottomHeight > 0){
                        me.set('resultHidden',true);
                        me.listen(me.scGridPaging, 'page-load-completed', '_onFocus');  // 페이징 처리 그리드를 위해 추가
                    }else{
                        me.listen(me.scGrid,'scgrid-count-changed','_onItemCountChanged');
                        if(me.isScrollPaging){ // 페이징 조회 시 전체건수를 갱신하기 위한 리스너
                            me.listen(me.scGridPaging, 'page-load-completed', '_onPageLoadCompleted');
                        }
                         if(me.scGrid._isInitialized && me.scGrid.provider.rowCount() > 0){
                            me.set('_gridItemCount', me.scGrid.provider.rowCount() )
                         }
                    }

                    // When click item. Save clicked Item.
                    me.listen(me.scGrid, "item-click", function(event)
                    {
                        var data = event.detail.data;
                        var item = event.detail.item;
                        var provider = event.detail.provider;

                        var _col = me.scGrid.getColumnElByName(item.columnName);

                        if (UT.isNotEmpty(_col))
                        {
                            if (_col.styleName == "link")
                            {
                                if (UT.isNotEmpty(data[item.dataField]))
                                {
                                    me.clickedItem = item;
                                }
                            }
                        }
                    });
                }
            },

...

            _onItemCountChanged : function(event){
                var me = this;
                var count = event.detail.count;
                me.set('_gridItemCount',count);
                if(me.isScrollPaging && count === 0) {
                    me.set('_gridTotalCount', count);
                }
                
                me.fire("item-count-changed");

                me._onFocus(event);
            },
            
            _onFocus : function(event)
            {
                var me = this;
                
                // Move focus to clicked Item.
                if (UT.isNotEmpty(me.clickedItem) && count > 0)
                {
                    me.scGrid.setCurrentCell({dataField:me.clickedItem.dataField, rowIndex:me.clickedItem.rowIndex});
                    me.scGrid.setTopIndex(me.clickedItem.rowIndex);
                    me.clickedItem = null;
                }
            }