Sample use cases for customization of global search
This topic provides some use cases of global search that are supported through customization.
Customize search display text for out-of-the-box search types
You can override the out-of-the-box search type display text by providing
displayBundleKey in the configuration.
The following JSON specification sample shows how to override the order search
description:
static extensionGlobalSearchConfigList: IGlobalSearchConfig[] = [
{
type: 'Order',
tid: 'Order',
displayBundleKey: 'orderSearch.TITLE_OrderSearch_Override'
}
]For information about adding new translation literals, see Defining a bundle entry for an existing component or module.
Customize search display component for out-of-the-box search types
The search viewed in the global search is a rendered component that is defined in the global search configuration. This component is rendered dynamically based on the specific search type configuration.
You can override the out-of-the-box search type component by providing a new component in the
component property in the configuration.
For example, to use a new custom search component
CustomSearchComponent as the
order search type, the JSON specification will be like the following sample:static extensionGlobalSearchConfigList: IGlobalSearchConfig[] = [
{
type: 'Order',
tid: 'Order',
component: CustomSearchComponent
}
]
Note:
- Ensure that you import the corresponding search component and the service or providers classes into global-search-extension.module.ts.
- Ensure that you are importing from store-extensions-src and not from the store-app-build folder.
Customize search icon class for out-of-the-box search types
You can override the default search type display icon class by providing
iconClass in the configuration. The following sample JSON specification shows how
to override order search icon
class:static extensionGlobalSearchConfigList: IGlobalSearchConfig[] = [
{
type: 'Order',
tid: 'Order',
iconClass: 'app-icon-custom'
}
]Customize search resource permission for out-of-the-box search types
You can override the out-of-the-box search type resource permission by providing
resourceId in the configuration. The following JSON specification shows how to
override the order search resource
permission:static extensionGlobalSearchConfigList: IGlobalSearchConfig[] = [
{
type: 'Order',
tid: 'Order',
resourceId: 'ISF000XYZ'
}
]Hide out-of-the-box search types
You can hide the out-of-the-box search types by setting the
hide property as
true in the configuration. The following JSON specification shows how you can hide
the out-of-the-box search
types:static extensionGlobalSearchConfigList: IGlobalSearchConfig[] = [
{
type: 'Order',
tid: 'Order',
hide: true
}
]