(21-10-2022, Saat: 15:10)vkamadan Adlı Kullanıcıdan Alıntı: [ -> ]burada örnek kod paylşırsanız kodunuzun üstünden fikir yürütelim.
UndiDbGrid in ClientEvents, ExtEvents, [store].load bölümündeki kod;
function store.load(sender, records, successful, operation, eOpts)
{
var tpl=new Ext.XTemplate(
'<div class="dvContainer">'+
'<table style="width:100%;border-collapse:collapse; height:100%;">'+
'<tr>'+
'<td style="width:85px;text-align:center;vertical-align:middle;">'+
'<img src="{[this.getProductImage(values)]}" style="width:50px;height:50px;margin:auto;"/>'+
'</td>'+
'<td style="width:50px;">'+
'<table style="width:100%;border-collapse:collapse;height:50px;text-align:center;">'+
'<tr>'+
'<td background="{[this.getKampanyaImage(values)]}"; background-repeat:no-repeat; style="width:85px; text-align:center;vertical-align:middle;">'+
'<br>'+
'</td>'+
'</tr>'+
'</table>'+
'</td>'+
'<td style="width:50px; font-weight: bold; color: #00008B; font-size: 16px; ">'+
'<table style="width:100%;border-collapse:collapse;height:50px;text-align:center;">'+
'<tr>'+
'<td background="{[this.getNakIskImage(values)]}"; background-repeat:no-repeat; style="width:85px; text-align:center;vertical-align:middle;">'+
'{15}'+
'</td>'+
'</tr>'+
'</table>'+
'</td>'+
'<td style="width:80px;">'+
'<table style="width:100%;border-collapse:collapse;height:50px;text-align:center;">'+
'<tr>'+
'<td>'+
'<a href="javascript:window.parent.ajaxRequest(sender, "hrefClick", ["hrefId=hrefId1"])">'+
'<img src="Simge/EkleBtn.svg" style="width:50px;height:50px;margin:auto;cursor:pointer;" '+
'/>'+
'<input type="button" id="btn1" name="btn1" value="ClickMe" onclick="callServer(this,"onclick")"><br>'+
'</a>'+
'</td>'+
'</tr>'+
'</table>'+
'</td>'+
'</tr>'+
'</table>'+
'</div>',
{
getProductImage: function(values){
return 'Resim/Urun/'+values[3]+'.jpg';
},
getKampanyaImage: function(values){
return 'Simge/'+values[11];
},
getNakIskImage: function(values){
return 'Simge/'+values[14];
},
getMiktar:function(values){
return Ext.util.Format.number(parseFloat(values[6]), '0,000');
},
getFiyat:function(values){
return Ext.util.Format.number(parseFloat(values[7]), '0,000.00 ₺');
},
getNetFiyat:function(values){
return Ext.util.Format.number(parseFloat(values[12]), '0,000.00 ₺');
},
getInsFiy:function(values){
return Ext.util.Format.number(parseFloat(values[13]), '0,000.00 ₺');
}
}
);
Ext.defer(function(){
sender.grid.setColumns([
{
text: '',
dataIndex: '0',
flex:1,
xtype: 'templatecolumn',
tpl: tpl
}
]);
sender.grid.getColumns()[0].show();
}, 500);
}
Simge/EkleBtn olduğu bölümü 2-3 farklı şekilde yazdım. fakat olmadı.
'<a href="javascript:window.parent.ajaxRequest(sender, "hrefClick", ["hrefId=hrefId1"])">'+
'<img src="Simge/EkleBtn.svg" style="width:50px;height:50px;margin:auto;cursor:pointer;" '+
'/>'+
'<input type="button" id="btn1" name="btn1" value="ClickMe" onclick="callServer(this,"onclick")"><br>'+
'</a>'+
'<img src="Simge/EkleBtn.svg" style="width:50px;height:50px;margin:auto;cursor:pointer;" '+
'onClick="javascript:uAnaMenu.UrunGrid.btn1Click({0});"'+
procedure TuAnaMenu.UrunGridAjaxEvent(Sender: TComponent; EventName: string;
Params: TUniStrings);
begin
// UrunGrid.ClientEvents.ExtEvents.Values[]
UniMemo2.Lines.Add(params.Text);
// if EventName = 'select' then
// ShowMessage(Params.Values['hrefId']);
end;