Display Generic sObject in Lightning

 

In the last post we study how we can iterate map in Lightning. There is one more thing which we face many time is dynamic field binding. Visualforce wit dynamic field binding we can dynamically create field instance but in lightning this is a major limitation.

Today we will see how we can use dynamic sObject binding in visualforce. For this we will create a sample component to display dynamic fields.

Here we will create app to get Object details. for demo I have select Account object we can select any object here. We can also select any fields here including the parent fields(cross reference field).

Now we will pass the object and field name in another component. Where we will display them on UI.

So here we are using JavaScript to to get data from the field. This is similar of what we have done in Map Iteration post.

To display on UI I am using lightning:formattedText we can also use any other component as well.

dYnamicsObject.png

You can find the complete code here as well.

DO you want to add anything let me know in comments section. Happy programming 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.