<sc-grid-paging id="gridPaging"
                    url="findApprList.do" 
                    body="{{searchParam}}"
                    page-size-items="100, 200, 300, 400, 500, 1000"
                    default-page-index="2"
                    on-error="onPageLoadError"
                    on-response="onPageResponse"
                    on-page-load-completed="onPageLoadCompleted">
    </sc-grid-paging>
        onPageLoadError : function(event)
        {
            var me = this;
            
            //페이지 조회 중 오류가 발생하였습니다. 관리자에게 문의하세요.
            UT.alert("PIM.E0001");
        },

        // provider에 응답 데이터가 바인딩 되기전에 데이터를 핸들링 할 수 있다.
        onPageResponse : function(event)
        {
            var me = this;
            var _resultList = event.detail;

            if(me.formula("isMulti"))
            {
                _resultList.forEach(function(data, index, array)
                {
                    // 아래로직으로 신규 추가된 row는 현재 loop에서 포함되지 않더라.
   
                    data.no             = 1;
                    data.aprv_rqst_usr  = data.usr_nm_01;
                    data.aprv_line_01   = data.usr_nm_02;
                    data.aprv_line_02   = data.usr_nm_03;
                    data.aprv_line_03   = data.usr_nm_04;
                    data.aprv_line_04   = data.usr_nm_05;
                    data.aprv_line_05   = data.usr_nm_06;
                    data.aprv_line_06   = data.usr_nm_07;
                    data.aprv_line_07   = data.usr_nm_08;
                    data.aprv_line_08   = data.usr_nm_09;
                    data.aprv_line_09   = data.usr_nm_10;
                    data.aprv_line_10   = data.usr_nm_11;

                    var data2 = UT.copy(data);
                    data2.no             = 2;
                    data2.aprv_rqst_usr  = data.aprvemp_posnm_01;
                    data2.aprv_line_01   = data.aprvemp_posnm_02;
                    data2.aprv_line_02   = data.aprvemp_posnm_03;
                    data2.aprv_line_03   = data.aprvemp_posnm_04;
                    data2.aprv_line_04   = data.aprvemp_posnm_05;
                    data2.aprv_line_05   = data.aprvemp_posnm_06;
                    data2.aprv_line_06   = data.aprvemp_posnm_07;
                    data2.aprv_line_07   = data.aprvemp_posnm_08;
                    data2.aprv_line_08   = data.aprvemp_posnm_09;
                    data2.aprv_line_09   = data.aprvemp_posnm_10;
                    data2.aprv_line_10   = data.aprvemp_posnm_11;
                    _resultList.push(data2);

                    var data3 = UT.copy(data);
                    data3.no             = 3;
                    data3.aprv_rqst_usr  = data.aprv_dt_01;
                    data3.aprv_line_01   = data.aprv_dt_02;
                    data3.aprv_line_02   = data.aprv_dt_03;
                    data3.aprv_line_03   = data.aprv_dt_04;
                    data3.aprv_line_04   = data.aprv_dt_05;
                    data3.aprv_line_05   = data.aprv_dt_06;
                    data3.aprv_line_06   = data.aprv_dt_07;
                    data3.aprv_line_07   = data.aprv_dt_08;
                    data3.aprv_line_08   = data.aprv_dt_09;
                    data3.aprv_line_09   = data.aprv_dt_10;
                    data3.aprv_line_10   = data.aprv_dt_11;
                    _resultList.push(data3);
                });

                _resultList.sort(function(a, b)
                {
                    if (a.rownum_ > b.rownum_)
                    {
                        return 1;
                    }
                    else if (a.rownum_ < b.rownum_)
                    {
                        return -1;
                    }
                    else
                    {
                        if (a.no > b.no)
                        {
                            return 1;
                        }
                        else if (a.no < b.no)
                        {
                            return -1;
                        }
                        else
                        {
                            return 1;
                        }
                    }
                });
            }
        },

        // 페이징 조회 완료 시 발생.
        onPageLoadCompleted : function(event)
        {
            var me = this;
            var _resultList = event.detail.content;
            var _aprvList = [];
            
            if(me.formula("isMulti"))
            {
                _resultList.forEach(function(data, index, array)
                {
                    data.no             = 1;
                    data.aprv_rqst_usr  = data.usr_nm_01;
                    data.aprv_line_01   = data.usr_nm_02;
                    data.aprv_line_02   = data.usr_nm_03;
                    data.aprv_line_03   = data.usr_nm_04;
                    data.aprv_line_04   = data.usr_nm_05;
                    data.aprv_line_05   = data.usr_nm_06;
                    data.aprv_line_06   = data.usr_nm_07;
                    data.aprv_line_07   = data.usr_nm_08;
                    data.aprv_line_08   = data.usr_nm_09;
                    data.aprv_line_09   = data.usr_nm_10;
                    data.aprv_line_10   = data.usr_nm_11;
                    _aprvList.push(data);

                    var data2 = UT.copy(data);
                    data2.no             = 2;
                    data2.aprv_rqst_usr  = data.aprvemp_posnm_01;
                    data2.aprv_line_01   = data.aprvemp_posnm_02;
                    data2.aprv_line_02   = data.aprvemp_posnm_03;
                    data2.aprv_line_03   = data.aprvemp_posnm_04;
                    data2.aprv_line_04   = data.aprvemp_posnm_05;
                    data2.aprv_line_05   = data.aprvemp_posnm_06;
                    data2.aprv_line_06   = data.aprvemp_posnm_07;
                    data2.aprv_line_07   = data.aprvemp_posnm_08;
                    data2.aprv_line_08   = data.aprvemp_posnm_09;
                    data2.aprv_line_09   = data.aprvemp_posnm_10;
                    data2.aprv_line_10   = data.aprvemp_posnm_11;
                    _aprvList.push(data2);

                    var data3 = UT.copy(data);
                    data3.no             = 3;
                    data3.aprv_rqst_usr  = data.aprv_dt_01;
                    data3.aprv_line_01   = data.aprv_dt_02;
                    data3.aprv_line_02   = data.aprv_dt_03;
                    data3.aprv_line_03   = data.aprv_dt_04;
                    data3.aprv_line_04   = data.aprv_dt_05;
                    data3.aprv_line_05   = data.aprv_dt_06;
                    data3.aprv_line_06   = data.aprv_dt_07;
                    data3.aprv_line_07   = data.aprv_dt_08;
                    data3.aprv_line_08   = data.aprv_dt_09;
                    data3.aprv_line_09   = data.aprv_dt_10;
                    data3.aprv_line_10   = data.aprv_dt_11;
                    _aprvList.push(data3);
                });

                _aprvList.sort(function(a, b)
                {
                    if (a.rownum_ > b.rownum_)
                    {
                        return 1;
                    }
                    else if (a.rownum_ < b.rownum_)
                    {
                        return -1;
                    }
                    else
                    {
                        if (a.no > b.no)
                        {
                            return 1;
                        }
                        else if (a.no < b.no)
                        {
                            return -1;
                        }
                        else
                        {
                            return 1;
                        }
                    }
                });
                
                me.$.gridPanel.setDataProvider(_aprvList);
            }
        }