IT/nexacro
nexacro 그리드 셀에 내용이 길면 툴팁 보이기
heavenLake
2021. 2. 5. 11:31
반응형
nexacro 그리드 셀에 내용 중 셀에 크기보다 길경우 자동으로 툴팁을 보여주는 예제입니다.
Source
<?xml version="1.0" encoding="utf-8"?>
<FDL version="2.0">
<TypeDefinition url="..\default_typedef.xml"/>
<Form id="CellToolTip" classname="SH_Kiup_CellToolTip" left="0" top="0" width="1024" height="768" titletext="텍스트의 길이가 긴 경우 툴팁(tooltip)으로 보여주기2">
<Layouts>
<Layout>
<Grid id="Grid00" taborder="0" useinputpanel="false" left="2.54%" top="18" right="73.44%" height="110" binddataset="Dataset00" tooltiptype="hover" onmousemove="Grid00_onmousemove" style="font:10 굴림;">
<Formats>
<Format id="default">
<Columns>
<Column size="80"/>
<Column size="80"/>
<Column size="80"/>
</Columns>
<Rows>
<Row size="24" band="head"/>
<Row size="24"/>
</Rows>
<Band id="head">
<Cell text="Column0"/>
<Cell col="1" text="Column1"/>
<Cell col="2" text="Column2"/>
</Band>
<Band id="body">
<Cell text="bind:Column0"/>
<Cell col="1" text="bind:Column1" tooltiptext="aaa"/>
<Cell col="2" text="bind:Column2"/>
</Band>
</Format>
</Formats>
</Grid>
</Layout>
</Layouts>
<Objects>
<Dataset id="Dataset00" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" loadfiltermode="keep" reversesubsum="false">
<ColumnInfo>
<Column id="Column0" type="STRING" size="256"/>
<Column id="Column1" type="STRING" size="256"/>
<Column id="Column2" type="STRING" size="256"/>
</ColumnInfo>
<Rows>
<Row>
<Col id="Column0">1</Col>
<Col id="Column1">test test test test 123</Col>
<Col id="Column2">abc</Col>
</Row>
<Row>
<Col id="Column0">2</Col>
<Col id="Column1">test1</Col>
<Col id="Column2">tobesoft nexacro test</Col>
</Row>
<Row>
<Col id="Column0">3</Col>
<Col id="Column1">test2345678901234567890</Col>
<Col id="Column2">abcdefghijklmnopstuvwxyz</Col>
</Row>
</Rows>
</Dataset>
</Objects>
</Form>
</FDL>
Script
this.Grid00_onmousemove = function(obj:Grid, e:nexacro.GridMouseEventInfo)
{
var nCellSize = obj.getFormatColSize(e.cell);
var strText = obj.getCellText(e.row, e.cell);
var nTextLen = nexacro.getTextSize( strText, "normal normal 12px NanumGothic");
if( nCellSize < nTextLen.nx){
obj.setCellProperty( "Body", e.cell, "tooltiptext", strText);
} else {
obj.setCellProperty( "Body", e.cell, "tooltiptext", "");
}
}
반응형