![](/img/trans.png)
[英]How do I configure Unity to create a class that takes two different items of same type?
[英]How do I create two images in same column within a slickgrid?
我正在嘗試在我的slickgrid的一欄中選擇和刪除圖像,但無法這樣做。 我知道如何做這樣的單個圖像按鈕。 :
var column = {id:delCol, field:'del', name:'Delete', width:250, formatter:buttonFormatter}
//Now define your buttonFormatter function
function buttonFormatter(row,cell,value,columnDef,dataContext){
var button = "<input class='del' type='button' id='"+ dataContext.id +"' />";
//the id is so that you can identify the row when the particular button is clicked
return button;
//Now the row will display your button
}
關於如何做到這一點的任何想法?
該單元格的數據應包括數組或{}(對象)都需要的兩個圖像/按鈕。
然后為一個單元格同時創建一個格式化程序:
// if value is [dataContext.delete.id, dataContext.add.id] for example
function twoButtonFormatter(row, cell, value, columnDef, dataContext) {
var str = ''; // initialize a string
// First button
str += "<input class='del' type='button' id='"+ value[0] +"' /> ";
// second button
str += "<button data-id='"+value[1]+"' class='add'>Add</button>";
// return the html string of both buttons
return str;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.