It's All Writing.

Writing makes you happy.

How to make a lightning component which is a sObjects selector and is a field selector which interlocks with specified sObject.

Environment

  • Apex
  • Lightning component

Image

Code

gist.github.com

Usage

In your original application or component, You can use InterlockSelector component as below like.

gist.github.com

Important point

In InterlockSelectorController.js init method, this method call an other method ( changeNameAttribute ) which is in same controller. changeNameAttribute method is handler which runs objectName or fieldName are changed and set correct values. But, on default, change handler not called when initialization. init handler only called. So, init method also call changeNameAttribute method above.

The way to call same controller's method is simple.

let anyOtherMethodYouWantCall = component.get('c.anyOtherMethodYouWantCall');
$A.enqueueAction(anyOtherMethodYouWantCall);

Referecne

salesforce.stackexchange.com