You need to sign in to do that
Don't have an account?
Jayesh Babu A V
use variable to get a row data from datatable
Iam new to salesforce and I want to get the Name field from a datatable inside my controller js class. I used the following code to do it:
But, i didnt work. In this case, the value of 'name' is undefined. So, is there any other way to use variable as the field name instead of statically typing the field name?
Thanks very much.
var row = event.getParam('row'); var name = row.Name; System.debug(name);Everything is working fine. I am able to get the name data properly. But, my question is, is there any way to replace the field name 'Name' with a variable? I tried like this:
var row = event.getParam('row'); var nameC = component.get("v.nameColumn");//value of nameColumn is 'Name' var name = row.nameC; System.debug(name);
But, i didnt work. In this case, the value of 'name' is undefined. So, is there any other way to use variable as the field name instead of statically typing the field name?
Thanks very much.
var row = event.getParam('row');
var nameC = component.get("v.nameColumn");//value of nameColumn is 'Name'
var name = row[nameC];
System.debug(name);