Closed blackWins closed 1 year ago
in CodeGeneration_Crud We can add createGetListInput dto bool option
if createGetListInput true then modify below template: AppService IAppService
AppService
IAppService
MyAppService: CrudAppService<XX, XXDto, Guid, MyGetListInput , CreateUpdateXXDto, CreateUpdateXXDto> { //generated override CreateFilteredQueryAsync method protected override async Task<IQueryable<XX>> CreateFilteredQueryAsync(MyGetListInput input) { // TODO: AbpHelper generated return (await base.CreateFilteredQueryAsync(input)); } }
Or we can use autofilterer project package to override the CreateFilteredQueryAsync
Add MyGetListInput dto
MyGetListInput
public MyGetListInput:PagedAndSortedResultRequestDto { //entity all properties ... }
Index.cshtml.cs declare
Index.cshtml.cs
... public MyGetListInput MyFilter{get;set;} ...
Index.cshtml use dynamic form output MyFilter
Index.cshtml
... <abp-dynamic-form abp-model="MyFilter" id="My_Filter" /> ...
index.js add
index.js
... //inputAction var getFilter = function () { var input = {}; var formArr = JSON.parse( JSON.stringify($("#My_Filter").serializeArray()) .replace(/MyFilter./g, '')); formArr.forEach(function (data) { if (data.value != '') { input[abp.utils.toCamelCase(data.name)] = data.value; } }) return input; }; //listen input $("#My_Filter :input").on('input', function () { dataTable.ajax.reload(); }); var dataTable = $('#MyTable').DataTable(abp.libs.datatables.normalizeConfiguration({ ... ajax: abp.libs.datatables.createAjax(service.getList,getFilter), ... })); ...
https://github.com/EasyAbp/AbpHelper.CLI/pull/180
AbpHelper
in CodeGeneration_Crud We can add createGetListInput dto bool option
Application
if createGetListInput true then modify below template:
AppService
IAppService
Or we can use autofilterer project package to override the CreateFilteredQueryAsync
Dto
Add
MyGetListInput
dtoUiRazor
Index.cshtml.cs
declareIndex.cshtml
use dynamic form output MyFilterindex.js
add