Trying to show a push button in a cell. The column does not have any underlying data. Button’s purpose is to remove records.
Here is my code:
ListGrid:
getBaseStyle: function (record, rowNum, colNum) {
if (colNum == 4)
return "groovybutton"
else
return this.baseStyle}
Field:
title: "DEL", type:"text"
Style:
input.groovybutton
{
font-size:10px;
font-family:Trebuchet MS,sans-serif;
font-weight:bold;
color:#FFFFFF;
height:19px;
background-color:#0077BB;
border-style:none;
}
Nothing is shown without data attached to the field. And just data is shown if it is attached.
Thanks
I am using some similar in my code. It might help you
{name:“remove”,title:‘Remove’,type:“date”,canEdit:true,
formatCellValue : function (value, record, rowNum, colNum) {
if (value==null || isc.isAn.emptyString(value)) return;
if (value ==1)
return isc.Canvas.imgHTML(“rebuttal_icon.jpg”,17,18);
} }
I wanna put this icon for newly added row so value is not attahched with data.
So, is it working for you?
am getting button but still working on to attach click functionaliy to remove currnt record from grid
Here is code I am using to catch a click on the image:
.....
cellClick:
function (record, rowNum, colNum)
{
if (colNum == 4)
alert(1);
},
....
HTH.
I did the same but its not deleting my current row .
I am using this
cellClick: function(record,rowNum,colNum) {
//if (colNum ==7 )
{
var curRec = this.dhuTab.resultList.getEditedRecord(rowNum);
alert(rowNum +", "+colNum+", "+isc.echoAll(curRec));
//this.dhuTab.resultList.selectRecord(curRec);
this.dhuTab.resultList.data.remove(curRec);
this.dhuTab.resultList.markForRedraw();
}
},
My ListGrid is bound to local data.
Here is how I am deleting the record:
cellClick:
function (record, rowNum, colNum)
{
if (colNum == 4 && record != null)
{
record.file_id = -1;
this.removeData(record)
}
}
Works with no problem to me.