ramanathansj / salesforce-lightning-datatable

Simple Datatable which takes SOQL query and creates native lightning datatables
Apache License 2.0
22 stars 8 forks source link

How I can get the Id of each result record? #5

Open lek3324 opened 6 years ago

lek3324 commented 6 years ago

I would like to get Id of each result record, in order to navigate to record. I try to put below code in JS controller, but it seem no Id put to param

navToRecord : function (component, event, helper) { var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": "component.get("v.results.fields.Id.value")" }); navEvt.fire(); }

ramanathansj commented 6 years ago

Next release of Datatable will support lookup fields by default similar to VF page lookups

You need to do below changes to make it work

  1. Modify OutputField Component
`{!v.cell.fieldValue}` {!v.cell.fieldValue} 2. Modify OutputField Component navigateTo : function(component, event, helper) { var recId = event.currentTarget.id; console.log("selected id == "+recId); var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": recId, "slideDevName": "detail" }); navEvt.fire(); } 3. By default current version of datatable will ignore Id columns in the query, so you need to change DatatableV2 component as well - Remove != Id check from header - Remove !=Id check from body rows as well
lek3324 commented 6 years ago

Oh, Thank you very much.

Regards,

Narongrit Inwang (Lex) +66891826386

On Nov 28, 2017 09:47, "ramanathan" notifications@github.com wrote:

Next release of Datatable will support lookup fields by default similar to VF page lookups

You need to do below changes to make it work

  1. Modify OutputField Component
{!v.cell.fieldValue} {!v.cell.fieldValue} 1. Modify OutputField Component navigateTo : function(component, event, helper) { var recId = event.currentTarget.id; console.log("selected id == "+recId); var navEvt = $A.get("e.force:navigateToSObject"); navEvt.setParams({ "recordId": recId, "slideDevName": "detail" }); navEvt.fire(); } 2. By default current version of datatable will ignore Id columns in the query, so you need to change DatatableV2 component as well - Remove != Id check from header - Remove !=Id check from body rows as well — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .