Smart Lookup

The Smart Lookup provides an user interface to select a record referenced by a foreign key value in a viewer.

Sample markup

                <smart-lookup 
                    smart-lookup-header="Lookup SalesRep" 
					smart-lookup-key-value-field="SalesRep"
                    smart-lookup-key-field="RepName" 
                    [(smartModel)]="selected.SalesRep" 
                    [smart-lookup-fields-binding]="{'RepName':'selected.eSalesrep[0].RepName'}" 
                    smart-business-entity-name="Consultingwerk.SmartComponentsDemo.OERA.Sports2000.SalesRepBusinessEntity" 
                    smart-entity-table="eSalesrep" 
                    smart-grid-layout="Consultingwerk.SmartComponentsDemo.OERA.Sports2000.SalesRepBusinessEntity/salesrep" 
                    id="SalesRep" 
                    smart-lookup-dialog-options="width=700px; height=500px;"
                    show-filter="true"
					[beforePerformLookup]="beforePerformLookupHandler"
                    allow-optional-filter-fields="true">
                </smart-lookup> 

Description

AttributeDescription
smart-lookup-headerThe title to display in the lookup's dialog
smart-lookup-key-fieldThe field used to search in the lookup's internal data source when the user types into the lookup. The value of this field is returned to the [(smartModel)] field in the viewer
[(smartModel)]The field that the lookup should update (note: use selected object reference to target the selected record of the containing viewer's data source, e.g. selected.SalesRep)
[smart-lookup-fields-binding]An object that defines the field mapping for additional field bindings between the lookup's selected record and the containing viewer's data source.
smart-lookup-key-value-fieldAn optional field used to search in the lookup's internal data source when the user types into the lookup. The value of this field is returned to the [(smartKeyValueModel)] field in the viewer. The smart-lookup-key-value-field is used to return an non-meaningful key value (e.g.) GUID to the viewer's data source
[(smartKeyValueModel)]The field that the lookup should update (note: use selected object reference to target the selected record of the containing viewer's data source, e.g. selected.SalesRep) with the smart-lookup-key-value-field
smart-business-entity-nameThe name of the business entity to be served by the lookup's internal data source. This business entity is used to return the records referenced by the foreign field values.
smart-entity-table

The business entity table to return records from

smart-grid-layout

The layout to be used by the grid displayed in the lookup's dialog, see Smart Grid

smart-lookup-dialog-optionsUsed to specify settings such as width and height for the lookup's dialog
show-filterOptional attribute which, if set to true, will display a Smart Filter in the lookup's dialog, defaults to false
filter-fields-initialOptional attribute to specify the initial fields that should be displayed by the lookup's dialog filter. If left unset, the first two fields from the JSDO schema used by the lookup's internal data source that aren't non filterable will be used.
allow-optional-filter-fieldsOptional attribute, which if set to true, will display optional filter fields in the lookup's dialog filter, defaults to false
filter-fields-optionalOptional attribute used to specify which optional filter fields should be displayed by the lookup's dialog filter. If left unset (and the allow-optional-filter-fields attribute is set to true), all fields that are not non filterable, except the first two, will be displayed.
smart-lookup-key-value-fieldOptional attribute used to specify the meaningful field (such as a GUID) that the lookup should retrieve. The user does not see the value of this field.
smart-server-side-filteringOptional attribute used for setting the serverSideFiltering property on the smart data sources connected to the lookup.
smart-foreign-fieldsThis optional setting can be used together with the queryString option, in order to filter the Smart Lookup's data source. There can be multiple foreignFields, divided by commas (Example: "Name,SalesRep").
smart-query-string

This option is used to filter the SmartLookup data source.

It can be used as a simple query, or together with the foreignFields option, like in the example below:

  • foreignField: "Name",
  • queryString: "for each eCustomer where eCustomer.Name = @Name@"

where @Name@ will be replaced by the foreign field value in the Smart Viewer.

provide-foreign-field-value

The name of a callback method implemented in the form, that can be used to modify the value of a given foreignField. It takes as an input parameter a ProvideForeignFieldValue instance. The value property should be altered directly on the input parameter.
[beforePerformLookup]Optional attribute representing an event handler that is called when a SmartLookupComponent is about to perform a lookup. The event arguments implement the IBeforePerformLookupEventArgs interface. It's properties are the following:
  • filter: 'for each eSalesrep where eSalesrep.Name = BBB' // Or an object of type SmartFilterDescriptor
  • queryString: "for each eSalesrep where eSalesrep.Name = BBB";
  • canceled: true/false