전체 그리드가 아닌 특정 sc-group-column 이하를 동적으로 구성하는 예시
- 동적구성할 sc-group-column에 data-field 지정한다. (아래 예시에서는 "견적금액"에 해당)
- 데이터 조회후 동적구성 함수 makeColumn 호출.
<dom-module id="es-sc-rfx-detail-dmst">
<style>
:host {
@apply(--vbox-layout);
}
</style>
<sc-grid id="gridPanel"
data-provider="{{bidVdList}}"
class="h-400"
editable="[[formula('enabledGrid')]]"
show-tooltip="true"
use-state="[[formula('enabledGrid')]]"
tooltip-duration="30000"
locked-column-count="1"
use-selection="[[formula('enabledBtnInitPW')]]"
selection-able-function="onSelectionAble"
on-item-click="onItemClick"
on-item-edit-end="onItemEditEnd">
<cc-grid-toolbar title-text="입찰 참여협력사">
</cc-grid-toolbar>
<sc-grid-columns>
<sc-group-column header-text="협력사"
hide-child-headers="false" width="510">
<sc-data-column header-text="코드"
data-field="vd_cd" width="80" text-align="center"
style-name="link"></sc-data-column>
<sc-data-column header-text="명"
data-field="vd_nm" width="140" text-align="left"
show-default-content-tooltip="true"></sc-data-column>
<sc-combobox-column header-text="구분"
data-field="dmt_ovs_cd" width="50" text-align="center"
display-field="label" value-field="data" items="{{codes.VD001}}"></sc-combobox-column>
<sc-combobox-column header-text="국가"
data-field="nat_cd" width="70" text-align="center"
display-field="label" value-field="data" items="{{codes.C001}}"></sc-combobox-column>
<sc-data-column header-text="대표자"
data-field="rep_nm" width="100" text-align="center"></sc-data-column>
<sc-data-column header-text="평가등급"
data-field="vd_grd" width="70" text-align="center"
item-style-function="onItemStyle"></sc-data-column>
</sc-group-column>
<sc-group-column header-text="공문/공고"
hide-child-headers="false" width="250" visible="[[formula('isApbdON')]]">
<sc-data-column header-text="수신자"
data-field="ofdc_rcv_cnt" width="60" text-align="center"
data-type="number" format-type="integer"
style-name="link"></sc-data-column>
<sc-checkbox-column header-text="발송여부"
data-field="sdng_yn" width="60"
checked-value="Y" un-checked-value="N" display-checkbox="false"
content-tooltip-callback="onContentTooltip"></sc-checkbox-column>
<sc-checkbox-column header-text="공고확인"
data-field="bid_anct_verify_yn" width="60"
checked-value="Y" un-checked-value="N" display-checkbox="false"
content-tooltip-callback="onContentTooltip"></sc-checkbox-column>
<sc-checkbox-column header-text="보안서약서"
data-field="sec_othpape_sign_yn" width="70"
checked-value="Y" un-checked-value="N" display-checkbox="false"
content-tooltip-callback="onContentTooltip"></sc-checkbox-column>
</sc-group-column>
<sc-checkbox-column header-text="개봉대상"
data-field="uslg_yn" width="70"
checked-value="Y" un-checked-value="N" display-checkbox="false"
item-editable-function="onItemEditable"></sc-checkbox-column>
<sc-data-column header-text="순위"
data-field="rnk" width="50" text-align="center"
data-type="number" format-type="integer"></sc-data-column>
<sc-group-column header-text="견적금액"
data-field="grpAmt" width="50" hide-child-headers="false">
<sc-data-column header-text="통화"
data-field="apbd_curr_cd" width="50" text-align="center"></sc-data-column>
</sc-group-column>
<sc-data-column header-text="예산대비"
data-field="bdg_comp_rt" width="80" text-align="right"
data-type="number" format-type="percentDecimal"></sc-data-column>
<sc-data-column header-text="차순위대비"
data-field="next_rnk_comp_rt" width="80" text-align="right"
data-type="number" format-type="percentDecimal"></sc-data-column>
<sc-group-column header-text="입찰평균가"
hide-child-headers="false" width="130">
<sc-checkbox-column header-text="대상"
data-field="avg_price_tagt_yn" width="50"
checked-value="Y" un-checked-value="N" display-checkbox="false"></sc-checkbox-column>
<sc-data-column header-text="대비"
data-field="avg_price_comp_rt" width="80" text-align="right"
data-type="number" format-type="percentDecimal"></sc-data-column>
</sc-group-column>
<sc-checkbox-column header-text="저가심의"
data-field="lowp_dlbt_yn" width="70"
checked-value="Y" un-checked-value="N" display-checkbox="false"
content-tooltip-callback="onContentTooltip"></sc-checkbox-column>
<sc-group-column header-text="입찰"
hide-child-headers="false" width="120">
<sc-combobox-column header-text="결과"
data-field="bid_rslt_se_cd" width="80" text-align="center"
display-field="label" value-field="data" items="{{codes.C208}}"
item-style-function="onItemStyle"
item-editable-function="onItemEditable"></sc-combobox-column>
<sc-image-column header-text="상세"
data-field="btn_more" width="40"
image-change-function="onImageChange"
item-style-function="onItemStyle"></sc-image-column>
</sc-group-column>
<sc-group-column header-text="투찰"
hide-child-headers="false" width="260">
<sc-date-column header-text="일시"
data-field="bidpape_sbms_dt" width="110" text-align="center"
display-format="yy-MM-dd HH:mm:ss"></sc-date-column>
<sc-data-column header-text="IP"
data-field="apbd_ip" width="100" text-align="center"></sc-data-column>
<sc-combobox-column header-text="유사도"
data-field="ip_sts_cd" width="50" text-align="center"
display-field="label" value-field="data" items="{{codes.SC259}}"
item-style-function="onItemStyle"></sc-combobox-column>
</sc-group-column>
<sc-image-column header-text="낙찰업체선정"
data-field="btn_choc_yn" width="90"
image-change-function="onImageChange"
item-style-function="onItemStyle"></sc-image-column>
</sc-grid-columns>
<sc-grid-fields>
<sc-grid-field data-field="sdng_dt" data-type="date"></sc-grid-field>
<sc-grid-field data-field="bid_anct_verify_dt" data-type="date"></sc-grid-field>
<sc-grid-field data-field="sec_othpape_sign_dt" data-type="date"></sc-grid-field>
</sc-grid-fields>
</sc-grid>
<script>
Polymer({
onResponse : function(event)
{
var me = this;
var _result = event.target.lastResponse;
switch (event.target.id)
{
case "selBID" :
var _rfq = me.domHost.rfq;
var _pr = me.domHost.pr;
var _bid = _result.bid; // Bid
var _brd = _result.brd; // Bid's Round
var _bidVdList = _result.bidVdList; // Bid's Vendor List
var _apvlList = me.domHost.apvlList; // Approval Log
me.set("rfq" , _rfq);
me.set("pr" , _pr);
me.set("bid" , _bid);
me.set("brd" , _brd);
me.set("bidVdList" , _bidVdList);
me.set("apvlList" , _apvlList);
me.makeColumn();
me.applyFormula();
break;
}
},
...
makeColumn : function()
{
var me = this;
var _grid = me.$.gridPanel;
var _provider = _grid.getDataProvider();
var _grpAmt = _grid.getColumnElByName("grpAmt");
var _width = 0;
if (UT.isNotEmpty(_grpAmt))
{
[].slice.call(_grpAmt.children).forEach(function(el, index, array)
{
if (el.dataField == "apbd_curr_cd")
{
_width = el.width;
}
else
{
_grpAmt.removeChild(el);
}
});
// 기본 1차는 보여준다.
var _bidCnt = UT.toNumber(UT.nvl(me.brd.bid_rev, 1));
for (var i = 1; i <= _bidCnt; i++)
{
var _col = document.createElement("sc-data-column");
_col.dataField = UT.formatString("bid_{0}_amt", i);
_col.headerText = UT.formatString("{0}차", i);
_col.width = 120;
// Round별 입찰결과 공개라면
var _rslt_opn_yn = "N";
if (UT.isNotEmpty(me.brdList))
{
_rslt_opn_yn = me.brdList[i - 1].rslt_opn_yn;
}
if (_rslt_opn_yn == "Y")
{
_col.textAlign = "right";
_col.dataType = "number";
_col.formatType = "amt";
}
else
{
_col.textAlign = "center";
}
_col.i18nDisabled = true;
_grpAmt.appendChild(_col);
_width += _col.width;
}
_grpAmt.width = _width;
// Grid에 반영
var columns = [].slice.call(_grid.getColumns());
_grid.setColumns(columns);
_grid.setDataProvider([]);
_grid.setDataProvider(me.bidVdList);
}
},
...
});
</script>
</dom-module>