StateGrid.cs 843 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Threading;
  3. using InABox.Core;
  4. using InABox.DynamicGrid;
  5. namespace PRSDesktop;
  6. public class StateGrid : DynamicDataGrid<State>
  7. {
  8. public Guid CountryId { get; set; }
  9. protected override void DoReconfigure(DynamicGridOptions options)
  10. {
  11. base.DoReconfigure(options);
  12. options.MultiSelect = true;
  13. }
  14. protected override void Reload(Filters<State> criteria, Columns<State> columns, ref SortOrder<State>? sort, CancellationToken token, Action<CoreTable?, Exception?> action)
  15. {
  16. criteria.Add(new Filter<State>(x => x.Country.ID).IsEqualTo(CountryId));
  17. base.Reload(criteria, columns, ref sort, token, action);
  18. }
  19. public override State CreateItem()
  20. {
  21. var result = base.CreateItem();
  22. result.Country.ID = CountryId;
  23. return result;
  24. }
  25. }