Hi,
I am trying to load grid data after anoth grid loaded. As there can be filtere applied on client side, I thought it would be better to just carry one transaction based on what is loaded.
Grid A load, grid B takes the data of grid A, filter and load.
Is there a way to have two listresponse, and how to call this service with the custom request?
public ListResponse<MyRow> List(IDbConnection connection, ListRequest request)
{
return new MyRepository().List(connection, request);
}
public ListResponse<MyRow> List(IDbConnection connection, CUSTOMListRequest request)
{
return new MyRepository().List(connection, request);
}
Or is there a way to simply hide rows accordings to the row id? (without setitems, in order to keep a reverse selection)
Thank you,
You can use equalityFilter
var equalFilter = { "yourField": YourValue };
YourNamespace..XYZService.List(
{ EqualityFilter: equalFilter },
response => {
if (response.Entities.length > 0) {
}
}
);
Thank you for your answer, but shouldn't I use "criteria" rather than equalityfilter?
My objective is to remove the ids present on the other grid.
Try something like this
var criteria = Serenity.Criteria;
criteria.join([criteria, '<', 2], 'or', [criteria, '>', 5]);
YourNamespace.XYZService.List(
{ Criteria: criteria as any },
response => {
if (response.Entities.length > 0) {
}
}
);
Thank you Estrusco,
If I may ask, is there a way to convert the items "fieldid" into a clean sql string?
Thank you,
Fot others what I did:
var items = this.parent.otherTab.view.getItems();
var request = this.view.params as SpecialListRequest;
for (let item of items){
request.Criteria= Serenity.Criteria.and(
request.Criteria, [['theId'], '!=', item.theId]);
}
this.refresh();
Thank you Estrusco. criteria.join does not work for me. I have tried and
let criteria = Serenity.Criteria.and([['fieldName_1'], '=', this.entity.Id], [['fieldName_2'], '=', this.userId]);
YourNamespace.XYZService.List(
{ Criteria: criteria as any },
response => {
if (response.Entities.length > 0) {
}
}
);
Most helpful comment
Fot others what I did: