SQL and Datatables with remoteAction
SQL and Datatables with remoteAction
i have created a List with this SQL query:
public static List<Opportunity> datatable_demo(){
return [SELECT Id, Name, Amount, Owner.name, Account.name, Acct_Billing_State__c, CloseDate,
(SELECT Date__c, Quantity__c,product__r.Name FROM Schedules__r WHERE Date__c != null AND Quantity__c>1 ORDER BY Date__c)
FROM Opportunity
WHERE (Opportunity.CloseDate = NEXT_N_MONTHS:5 OR
Opportunity.CloseDate = THIS_MONTH) AND
(Amount > 1 AND Name != null)
ORDER BY
CloseDate ASC,
Name ASC
];
And i am trying to reference the fields on a datatable:
$('#demo_table').dataTable({
"bJQueryUI": true, "sDom": 'flptir', "bAutoWidth": false,
"aoColumnDefs": [
{ "aTargets":["Id"], "mData":"Id", sClass:"Id", "bAutoWidth": false },
{ "aTargets":["Ownername" ], "mData":"Owner.Name", sClass:"Ownername", "bAutoWidth": false },
{ "aTargets":["Name"], "mData":"Name", sClass:"Name", "bAutoWidth": false },
{ "aTargets":["Account.name"], "mData":"Account.Name", sClass:"Account.name", "bAutoWidth": false },
{ "aTargets":["BS"], "mData":"Acct_Billing_State__c", sClass:"BS", "bAutoWidth": false },
{ "aTargets":["Amount"], "mData":"Amount", sClass:"Amount", "bAutoWidth": false },
{ "aTargets":["Schedule1"], "mData":"Schedules__r.Quantity__c", sClass:"Schedule1", "bAutoWidth": false }
],
Only Schedules__r.Quantity__c doesnt populate. Any ideas?
Answers
I solved it myself!
Schedules__r.1.Quantity__c
Schedules__r.2.Quantity__c
Schedules__r.3.Quantity__c
.
.
.