I have an aggregate root that has a collection of objects called Directives. A Directive has three properites – Name, Type, and ExpirationDate. Directives inherit from Entity and they should not be a Value Object. I want to display the collection in a DataTable on the aggregate root’s page (MVC Razor). So if I go to a specific account, that account can have 0:Many Directives.
When setting up the DataTable’s ajax method:
ajax: abp.libs.datatables.createAjax(exitus.advanceCareVault.accounts.account.getDirectives, function () {
return {
accountId: $('#Account_Id').val()
}
})
I would like to pass the accountId value as a parameter to the service as well as the PagedResultDto as input.
The signature on the Application Service is as follows:
Task<PagedResultDto<DirectiveDto>> GetDirectivesAsync(Guid accountId, PagedResultRequestDto input)
Which generates the following error:
“Cannot read properties of undefined (reading ‘skipCount’)”
So the question is – how do I pass a parameter as well as use the PagedResultRequstDto?
I believe I need to use one of the Paged and List DTO objects.
I have tried the following to no avail:
Task<PagedResultDto<DirectiveDto>> GetDirectivesAsync(Guid accountId, PagedResultRequestDto input);
ajax: abp.libs.datatables.createAjax(exitus.advanceCareVault.accounts.account.getDirectives, { accountId: $('#Account_Id').val() })
I get the following error:
“jQuery.Deferred exception: Cannot read properties of undefined (reading ‘skipCount’) TypeError: Cannot read properties of undefined (reading ‘skipCount’)”
My Dynamic ServiceProxy looks like the following:
exitus.advanceCareVault.accounts.account.getDirectives = function(accountId, input, ajaxParams) {
return abp.ajax($.extend(true, {
url: abp.appPath + 'api/app/account/directives/' + accountId + '' + abp.utils.buildQueryString([{ name: 'skipCount', value: input.skipCount }, { name: 'maxResultCount', value: input.maxResultCount }]) + '',
type: 'GET'
}, ajaxParams));
};