How to Add Filter to Virtual Lookup

Hi All,

How to add filter to the virtual Lookups, I had added virtual lookup for contact entityschema. And when I tried to add filter to that, its not filtering out the data.

I have attached my code for the reference,





 

After adding the filter I am able to see all the values in the Lookup.

Is there a way, to Filter the Lookup values in Virtual lookup column ?

 

Regards,

Adharsh S

Like 0

Like

6 comments

Hello Adharsh,

Something else must be going wrong. I just tested this and my filters do get applied to the virtual lookup for me. My code looks like this: 

"ContactLookup": {
	dataValueType: Terrasoft.DataValueType.LOOKUP,
	type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
	caption: "Test",
	referenceSchemaName: "Contact",
	isSimpleLookup: true,
	lookupListConfig: {
		filters: [function() {
			var filters = Ext.create("Terrasoft.FilterGroup");
			filters.add("TestFilter", Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Name", "Ryan Farley"));
			return filters;
		}]
	}
}

and the result is: 

Ryan

Hello Adrash,

 

We've also tested Ryan's code and it works. Please use the same approach on your side to complete the business task.

 

Best regards,

Oscar

Ryan Farley, Oscar Dylan,

 

I have even tried with your code also, But I still find the same result. There is no error in console too. I am not sure what is been missed.





 

The only difference I could see is that I have implemented this virtual lookup in the Detail schema page and you have done this is Edit Page of a section.

Will this make any difference it Filtering the records?  Ideally it shouldn't do such way.



Regards,

Adharsh S

Adharsh,

 

You need to debug the logic and see if the filter is returned upon:

 

var filters = Ext.create("Terrasoft.FilterGroup");
			filters.add("TestFilter", Terrasoft.createColumnFilterWithParameter(Terrasoft.ComparisonType.EQUAL, "Name", "Ryan Farley"));
			return filters;

execution. Also check if there is no other logic is connected to the same column which may affect the filter.

 

Best regards,

Oscar

This is an old thread, but I wanted to renew the conversation.  I'm having the same issue.  I've filtered lookups many times this way with no issue. 

 

I have a modal page that inherits from BaseEntityPage.  There is a virtual lookup on the page.  With isSimpleLookup = true, the lookup won't reference lookupListConfig at all.  It just ignores it.  If I change isSimpleLookup = false, it will reference lookupListConfig and fire the code for filter.  My problem is that since my module is already in a modal window, the lookup cant render as a modal also.  I must use a simple lookup.  I can filter simple lookups on other modules, but not this one.  There must be something different about how the module is being rendered.

 

Any thoughts on how to get the simple lookup to filter here, or be able to use a modal lookup on another modal page?

 

More on this.  So it looks like this is an issue inheriting from BaseEntityPage.  I changed my modal module to inherit from BasePageV2 and now it works.  Not sure if this is expected and I'm not sure what other issues I'll face using BasePageV2, as this is "base card schema".

Show all comments