2015-01-19 3 views

답변

2

일반적으로 셀 사용자 정의는 formatters을 통해 처리됩니다.

grid options을 통해 설정할 수 있지만 will be static이므로 이미지의 크기가 다양하면 약간의 렌더링 사용자 정의가 필요하거나 다른 그리드 프레임 워크가 필요할 수 있습니다.


 
var grid; 
 
var data = [{id: 1, src: 'http://i.stack.imgur.com/Cj07W.jpg?s=128&g=1', txt: 'Some text' }, {id: 2, src: 'https://www.gravatar.com/avatar/4a7ca5a83afc1e7a43bf518ccaa3c9be?s=128&d=identicon&r=PG&f=1', txt: 'Some different text' }]; 
 
var columns = [ 
 
    {id: "id", name: "rowId", field: "id"}, 
 
    {id: "img", name: "Image", field: "src", formatter: function(args){ return "<span>"+data[args].txt+"</span><br/><img src ='" + data[args].src + "'></img>" }} 
 
]; 
 

 
var options = { 
 
    enableCellNavigation: true, 
 
    forceFitColumns: true, 
 
    rowHeight: 175  
 
}; 
 

 
grid = new Slick.Grid("#myGrid", data, columns, options);
<link rel="stylesheet" type="text/css" href="http://mleibman.github.io/SlickGrid/slick.grid.css"> 
 
<link rel="stylesheet" type="text/css" href="http://mleibman.github.io/SlickGrid/css/smoothness/jquery-ui-1.8.16.custom.css"> 
 

 
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script> 
 
<script src="http://mleibman.github.io/SlickGrid/lib/jquery-ui-1.8.16.custom.min.js"></script> 
 

 
<script src='http://mleibman.github.io/SlickGrid/lib/jquery.event.drag-2.2.js'></script> 
 
<script src='http://mleibman.github.io/SlickGrid/slick.core.js'></script> 
 
<script src='http://mleibman.github.io/SlickGrid/slick.grid.js'></script> 
 
<script src='http://mleibman.github.io/SlickGrid/slick.formatters.js'></script> 
 
    
 
<div id="myGrid" style="width:600px;height:500px;"></div>

+0

내가이 예에서는 하나의 예 http://mleibman.github.io/SlickGrid/examples/example-plugin-headerbuttons.html를 발견했을 때 2 열 머리글을 통해 내 마우스 포인팅, 그것은 "도움 이미지"를 보여주고 있습니다 ... 같은 방식으로 ... 제 요구 사항은 제 2 칸 셀에서 같은 행동이 필요합니다 ... 가능합니까? – prakash

+0

질문에 대한 나의 해석과 완전히 다른 컨텍스트이므로이 추가 정보로 원래 질문을 업데이트/편집해야합니다. 헤더 셀에 표시된 "본문"셀에서는 아무 것도 수행 할 수 있어야하지만 헤더 셀 기능이 이미 구현되어 플러그인을 통해 제공되므로 더 많은 구현이 필요합니다. – Origineil