Access lookup column in Section GridRowViewModel

in a custom SectionGridRowViewModel I need to access oa lookup column:

     just like as in

var isPlanned = this.get("FinEntryStatus").displayValue;

     I need to access the "FinType" field, such as in

var isPlanned = this.get("FinEntryStatus").FinType;

I tried to use  "lookupListConfig", but had no success.

...

          attributes: {

                    "FinEntryStatus": {

                        lookupListConfig: {

                            columns: ["FinType"]

                        }

                    }

          },

...

Please help.

Regards,

Like 0

Like

3 comments

Hi Ricardo, 

 

You need to use ActiveRow in order to get the value from the registry page.

 

Please try to use this code :

 

this.getActiveRow().get("Lookup column name").displayValue - it will return the value 

 

Please check the example below: 

 

 

Best Regards, 

 

Bogdan L 

 

 

 

Bogdan Lesyk,

Thanks for your reply. 

Clarifying:

I have a lookup named "FinEntryStatuses", which has columns, "Name", "Description", "FinType", etc

At a given selected row, with

      this.getActiveRow().get("FinEntryStatus").displayValue;

I get "Scheduled" as a response (which is  the "Name" column displayValue)

What I need is to access the "FinType" row displayValue, not the "Name" row displayValue.

would it be 

     this.getActiveRow().get("FinEntryStatus").value.get("FinType").displayValue;

?

 

 

Hi Ricardo, 

 

I will show you how it looks like: 

 

Lets imagine you are using Contacts section and you have Lookup "Type" of your contact. Here you have some values of this Lookup like "Contact person", "Customer", "Employee", "Supplier". And you picked value "Employee" for your contact.

 

 

Then in order this Lookup to be visible with "activeRow" you should go to View page and add the Lookup "Type" to fields which will be displayed. 

 

After this changes you will see the your Lookup on the registry page with selected value (Type, "Employee") like on the example above.

 

 

So therefore you will be able to get the value of chosen Lookup(which is already added on the selected record).

 

If you debug this code in your browser you can see that value of needed Lookup is visible and you can take it for your further actions. Example below: 

 

 

Please make sure that you added this Lookup on the registry page and choose the value for it, because otherwise it won't be visible  and you will not be able to take this value(pic.2).

 

 

Best Regards, 

 

Bogdan L.

Show all comments