onContentReady: function(e) {
if (!e.component.detayColumnAdded) {
e.component.detayColumnAdded = true;
e.component.addColumn({
cellTemplate: function(cellElement, args) {
//$("<a>").text("Detay").on("click", function () {
$('<a/>').addClass('dx-link')
.text('Detay')
.on('dxclick', function(info) {
var dataGrid = $('#mygrid').dxDataGrid('instance');
$.each(dataGrid.getSelectedRowsData(), function() {
var usd = "USD BAKİYE"
console.log(this.usd); // BUT UNDEFİNED.
});
}).appendTo(cellElement)
}
});
}
},
I am collecting information from the column according to the data coming from ajax. The ajax tell me how to get information according to usd balance. But this is not always the same. Get information from TL balance column.. So I defined the variable usd. This variable is equal to the name of the column. Then I wrote this.Usd undefined in the console. How do I solve this problem. How i will make it dynamic. Can you give a suggestion?
Instead use the
[]
notation when you are using variable names to get the key of the object:Another option will be to pass the param in the callback function of the
jQuery.each()
: