RealGrid2 API
Interface
IconCellRenderer

IconCellRenderer

아이콘 렌더러

Signature:

export interface IconCellRenderer extends CellRenderer 

Extends: CellRenderer

Remarks

이미지 아이콘과 텍스트를 같이 표시한다.

url을 직접 지정하여 표시할 수도 있다.

CellRenderer 를 상속한다.

[제한 사항]

  1. iconLocation = RIGHT: 텍스트가 길면 아이콘이 표시되지 않을 수 있다.

  2. 자동 높이에서 TOP_EDGE, BOTTOM_EDGE를 사용할 수 없다.

[상위 클래스]

CellRenderer

Example

// string type
column.renderer = 'icon';
 
// object type
column.renderer = {
    "type": "icon",
    "iconMap": {
        "UPQRK": "images/particles/uquark.png",
        "DOWNQRK": "images/particles/dquark.png",
        "ELECTRN": "images/particles/e.png",
        "ELECNEU": "images/particles/eneutrino.png",
    },
    "iconHeight": 11
},

Events

PropertyModifiersTypeDescription
iconCallbackGetImageCallback아이콘 이미지의 렌더링을 위한 콜백
titleCallbackGetCellTitleCallback이미지의 alt 텍스트를 설정하기 위한 콜백

Properties

PropertyModifiersTypeDescription
enterKeybooleantrue이면 enterKey를 입력했을때 onCellItemClicked 가 실행된다.
exportImagebooleantrue이면 excel로 이미지를 export한다.
iconFieldstring아이콘 이미지 렌더링을 위해 url 값으로 읽어올 필드의 필드명
iconLocationIconLocation렌더링되는 아이콘의 위치
iconMap{ [value: string]: string; }셀 값과 해당 셀 값에 대응시킬 url 의 키-값 쌍
iconUrlstring보여줄 아이콘 이미지의 url
spaceKeybooleantrue이면 스페이스바를 입력했을때 onCellItemClicked 가 실행된다.
type"icon"종류: 아이콘

Events Desc

iconCallback

아이콘 이미지의 렌더링을 위한 콜백

Remarks:

undefined 반환 시 해당 콜백에 의한 렌더링이 취소된다.

GetImageCallback 의 형식을 따른다.

Example:

column.renderer = {
     "type": "icon",
     "iconCallback": function (grid, cell) {
         return "images/teraforming/mars.jpg";
     }
}

titleCallback

이미지의 alt 텍스트를 설정하기 위한 콜백

Remarks:

설정할 alt 텍스트를 반환해야 한다.

GetCellTitleCallback 의 형식을 따른다.

Example:

const f = function(grid, model) {
     return 'cat image'
}
column.renderer = {
     type: 'icon',
     titleCallback: f
}

Properties Desc

enterKey

true이면 enterKey를 입력했을때 onCellItemClicked 가 실행된다.

exportImage

true이면 excel로 이미지를 export한다.

Remarks:

GridExportOptions.exportImagefalse이면 출력되지 않는다.

iconField

아이콘 이미지 렌더링을 위해 url 값으로 읽어올 필드의 필드명

Remarks:

IconCellRenderer.iconCallback 이 할당되어 있지 않거나 undefined를 반환한 경우 적용된다.

Example:

column.renderer = {
     "type": "icon",
     "iconField": "Cats"
}

iconLocation

렌더링되는 아이콘의 위치

iconMap

셀 값과 해당 셀 값에 대응시킬 url 의 키-값 쌍

Remarks:

IconCellRenderer.iconCallback 이 할당되어 있지 않거나 undefined를 반환한 경우 적용된다.

Example:

column.renderer = {
     type: 'icon'
     iconMap: {
         value1: 'images/e_equals_mc_square.jpg'
     }
}

iconUrl

보여줄 아이콘 이미지의 url

Remarks:

IconCellRenderer.iconMap 이 설정된 경우, 해당 설정된 값은 무시된다.

spaceKey

true이면 스페이스바를 입력했을때 onCellItemClicked 가 실행된다.

type

종류: 아이콘