In platform 6.5+ you can extend the search-results.xml : ftsSearchResults screen and override just one specific method of its controller: openEntityWindow()
I am using the latest version of studio 6.5.5 and I only have the fts-config file (fts.xml)
Can you please provide me the path for the search-result.xml file?
First, make sure your project is based on the platform 6.5+. See Project properties > Platform version.
Select web package on the Generic UI tab and click New. Select the “Extend an existing screen” template and find “search-results.xml : ftsSearchResults” in the “Extend screen” field (see screenshot attached). Create the extended screen and open its controller in the IDE. Override the openEntityWindow() method as follows:
public class ExtSearchResultsWindow extends SearchResultsWindow {
@Override
protected void openEntityWindow(SearchResult.Entry entry, String entityName, WindowManager.OpenType openType) {
// this is the standard implementation, you can replace it
WindowConfig windowConfig = AppBeans.get(WindowConfig.NAME);
MetaClass metaClass = metadata.getSession().getClass(entityName);
Entity entity = reloadEntity(metaClass, entry.getId());
openEditor(windowConfig.getEditorScreenId(metaClass), entity, openType);
}
}
Do I have to change something to make it work for browser screen only?
I did the exact same thing but when I search and click on the result it gives me an error saying 'no such editor screen is found’
So, I change it to getBrowserScreenID but it throws the ClassCastException.
Of course it doesn’t, because you just open the screen. Your screen should have some logic to position on a record. But what if there are thousands of records in the database and they do not fit to one page? I see only one reliable way to position on a record - apply a filter by entity ID to show only this single entity. Is it what you want?