Hi Martin,
This can be achieved but won’t look exactly the same as a datagrid/listview/templategrid. There are two options on how to do this. The first option, is to use a microflow to retrieve and return your data. The second option is to define the entity type and any xpath constraints that need to be applied.
A good example on how to do both of these option is the autocomplete widget
https://github.com/AuraQ/AutoCompleteForMendix/tree/master/src
Here is how your .xml file could look like for both options:
First option (microflow):
Define the entity type
<property key="dataAssociation" type="entity" required="true" isPath="yes" pathType="reference" allowNonPersistableEntities="true">
<caption>Entity Type</caption>
<category>Search</category>
<description> </description>
</property>
Define the microflow and return type
<property key="searchMicroflow" type="microflow" required="false">
<caption>Search microflow</caption>
<category>Search - Microflow</category>
<description>Run this microflow to execute the search</description>
<returnType type="Object" isList="true" entityProperty="dataAssociation"/>
</property>
Second Option (xpath):
Define the entity type
<property key="dataAssociation" type="entity" required="true" isPath="yes" pathType="reference" allowNonPersistableEntities="true">
<caption>Entity Type</caption>
<category>Search</category>
<description> </description>
</property>
Define the xpath constraint
<property key="dataConstraint" type="entityConstraint" required="false" entityProperty="dataAssociation">
<caption>Data constraint</caption>
<category>Search</category>
<description></description>
</property>
Then I would look at the client api documentation to see how to execute a microflow and retrieve using xpath in JS.
https://apidocs.mendix.com/8/client/
Hope this helps!