mmckenzie
(Meche-Ann McKenzie)
December 16, 2021, 8:18am
1
Is there a way to apply a filter to a dataInstanceStore? For example in the Car component below, is there a way to search on a specific attribute of Car on the dataInstance?
export class Car extends React.Component{
dataInstance=instance(Car.NAME,{
view:"_local"
})
{…rest of code}
}
v.basko
(Vadim Basko)
December 27, 2021, 8:26pm
5
Hi, @mmckenzie
DataInstanceStore is used to load instance by id. So you could not apply filter to it.
To load collection of instances filtered by attribute could be used DataCollectionStore with EntityFilter :
byModelFilter: EntityFilter = {
conditions: [{
property: 'model',
operator: 'contains',
value: 'm0'
}]
};
dataCollection = collection<Car>(Car.NAME, {
view: "car-edit",
loadImmediately: false,
filter: this.byModelFilter
});