I'm using PrimeNG controls(datatable, dropdown) at many places in UI, But every time I stuck with some issues. There is no good documentation and support for on StackOverflow for PrimeNG, So Do we have any alternative for the same?
Please help me to solve the below issue, if possible at your end.
[https://stackoverflow.com/questions/47144652/custom-sorting-not-working-in-primeng-datatable]) [https://stackoverflow.com/questions/47145123/custom-content-dropdown-not-working-in-primeng]) [https://stackoverflow.com/questions/47144857/filterig-is-not-working-in-primeng-datatable])
I have a columns FlgStdTest which is DEFAULT ((1)) and datatype is bit. I'm trying to insert the record with FlgStdTest as true or false, but its value is always inserted as true.
public async Task<int> CreateTest(TestDetailsDTO input)
{
int testId = await InsertAndGetIdAsync(ObjectMapper.Map<TestMaster>(input));
return testId;
}
[AutoMap(typeof(TestMaster))]
public class TestDetailsDTO : FullAuditedEntityDto
{
public string Test { get; set; }
public string TestDesc { get; set; }
public bool FlgStdTest { get; set; }
public bool FlgActive { get; set; }
}
Request:
{
"testType": "abc",
"testDesc": "xyz",
"flgStdtest": false,
"flgActive": false,
"isDeleted": false,
"deleterUserId": 0,
"deletionTime": "2017-10-05T10:50:13.956Z",
"lastModificationTime": "2017-10-05T10:50:13.956Z",
"lastModifierUserId": 0,
"creationTime": "2017-10-05T10:50:13.956Z",
"creatorUserId": 0,
"id": 0
}
How to solve Can't create component as it has dependencies to be satisfied in ASP.NET Boilerplate?
Getting error while running test. How to solve?
public class TestAppService : TestAppServiceBase, ITestAppService
{
private readonly ITestRepository _testRepository;
public TestAppService(ITestRepository testRepository)
{
_testRepository = testRepository;
}
public class TestAppService_Test : TestAppServiceTestBase
{
private readonly ITestAppService _testAppService;
public TestAppService_Test()
{
_testAppService = Resolve<ITestAppService>();
}
Test Name:
ABC.XYZ.Tests.PQR.TestAppService_Test.Should_Create_Test_With_Valid_Arguments
Test FullName: ABC.XYZ.Tests.PQR.TestAppService_Test.Should_Create_Test_With_Valid_Arguments (20f54c54e5d9f077f4cb38b988ecb8e63e07d190)
Test Source: C:\Users\viveknuna\source\repos\XYZ\aspnet-core\test\ABC.XYZ.Tests\PQR\TestAppService_test.cs : line 25
Test Outcome: Failed
Test Duration: 0:00:00.001
Result StackTrace:
at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
at Castle.Windsor.WindsorContainer.Resolve[T]()
at ABC.XYZ.Tests.PQR.TestAppServiceTestBase..ctor() in C:\Users\viveknuna\source\repos\XYZ\aspnet-core\test\ABC.XYZ.Tests\PQR\TestAppServiceTestBase.cs:line 14
at ABC.XYZ.Tests.PQR.TestAppService_Test..ctor() in C:\Users\viveknuna\source\repos\XYZ\aspnet-core\test\ABC.XYZ.Tests\PQR\TestAppService_test.cs:line 17
Result Message:
Castle.MicroKernel.Handlers.HandlerException : Can't create component 'ABC.XYZ.Business.Services.PQR.TestAppService' as it has dependencies to be satisfied.
'ABC.XYZ.Business.Services.PQR.TestAppService' is waiting for the following dependencies:
- Service 'ABC.XYZ.Business.Repositories.Interfaces.ITestRepository' which was not registered.
I have a calendar control, I want to set some value to it, but I get the following error on the below line and value also does not get set.
this.data.dateIn = this.selecteddata.dateIn; //both are moment type
<p-calendar [(ngModel)]="data.dateIn" [showIcon]="true" name="dateInCalendar"
required #dateInCalendar="ngModel">
</p-calendar>
Error:
ERROR Error: Uncaught (in promise): TypeError: date.getMonth is not a function TypeError: date.getMonth is not a function at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.formatDate (calendar.js:649) at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.updateInputfield (calendar.js:252) at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.writeValue (calendar.js:595) at forms.es5.js:1779 at forms.es5.js:2965 at Array.forEach () at FormControl.webpackJsonp.../../../forms/@angular/forms.es5.js.FormControl.setValue (forms.es5.js:2965) at forms.es5.js:4367 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:365) at Object.onInvoke (core.es5.js:3890) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:364) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:125) at zone.js:758 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:398) at Object.onInvokeTask (core.es5.js:3881) at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.formatDate (calendar.js:649) at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.updateInputfield (calendar.js:252) at Calendar.webpackJsonp.../../../../primeng/components/calendar/calendar.js.Calendar.writeValue (calendar.js:595) at forms.es5.js:1779 at forms.es5.js:2965 at Array.forEach () at FormControl.webpackJsonp.../../../forms/@angular/forms.es5.js.FormControl.setValue (forms.es5.js:2965) at forms.es5.js:4367 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:365) at Object.onInvoke (core.es5.js:3890) at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke (zone.js:364) at Zone.webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run (zone.js:125) at zone.js:758 at ZoneDelegate.webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask (zone.js:398) at Object.onInvokeTask (core.es5.js:3881) at resolvePromise (zone.js:710) [angular] at :4200/polyfills.bundle.js:7469:17 [angular] at Object.onInvokeTask (core.es5.js:3881) [angular] at drainMicroTaskQueue (zone.js:591) [] at XMLHttpRequest.ZoneTask.invoke (zone.js:464) []
I have a page in that I have a table. There is one column named "Actions".
Action-menu is shown with Edit and Delete, once the user clicks on the action-column in any row. I redirect to another html page once the user clicks on edit.
Everything is working fine. But the menu does not disappear after redirecting to another page. If I go back and again click on a action-column, a new menu with edit and delete appears.
<p-dataTable #dataTable>
<p-column field="" header="{{l('Actions')}}" [sortable]="false" [style]="{'width':'25px'}">
<ng-template let-record="rowData" pTemplate="body">
<div class="btn-group dropdown" normalizePosition>
<button class="dropdown-toggle btn btn-xs btn-primary blue"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false">
<i class="fa fa-cog"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a (click)="onEditClick(record, $event)">{{ l('Edit') }}</a>
</li>
<li>
<a (click)="onDeleteClick(record, $event)">{{ l('Delete') }}</a>
</li>
</ul>
</div>
</ng-template>
</p-column>
</p-dataTable>
onEditClick(selectedValue: any): void {
this.router.navigate(['/app/xyz/pqr', data.id]);
}
I have a table which has the Id as primary key, I want to have a composite unique key on Code and Value column. I'm trying in this way.
[Table("Test")]
public class Test: FullAuditedEntity
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public virtual int Code { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public virtual int Value { get; set; }
But it's making the composite primary key not unique key.
I have a table which has the code as primary key instead of Id, When I call DeleteAsync method I get the exception Message = "Cannot update identity column 'Id'.".
[Table("Test")]
public class Test: FullAuditedEntity<int>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
new public int Id { get; set; }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
public virtual int Code { get; set; }
public async Task DeleteTest(int code)
{
try
{
await _supplierRepository.DeleteAsync(p => p.Code== code);
}
catch (Exception ex)
{
}
}
But If I remove Id column from the table, it works fine. I want both Id column and Code column as PK.
I have gone through some posts, there it is mentioned that primary key has to be Id. Why Abp framework enforces to use only ID as primary key, there has to be some strong reason behind it.
I have defined a method defined in AppService file, Signature of method is
public PagedResultDto<FetchData> GetSearchData(FetchDataInput searchInput)
. I'm calling this method from Angular code, but
service-proxoes.ts
file has generated method in which I need to pass all the parameters one by one.
public class FetchDataInput: PagedAndSortedInputDto, IShouldNormalize
{
public int DataLevel { get; set; }
public int DataType { get; set; }
public string DataCode { get; set; }
public string DescLong { get; set; }
public string LanguageCode { get; set; }
public string DataParent { get; set; }
public void Normalize()
{
if (string.IsNullOrEmpty(Sorting))
{
Sorting = "DataCode";
}
}
}
Service-Proxies.ts file:
getSearchData(dataLevel: number, dataType: number, dataCode: string, descLong: string, languageCode: string, dataParent: string, sorting: string, maxResultCount: number, skipCount: number): Observable<PagedResultDtoOfFetchData> {
So I have to call the getSearchData method by the following way.
this._dataService.getSearchData(AppConsts.dataLevelType, undefined, undefined,
undefined, this.currentLanguage.name, undefined, undefined, undefined, undefined).subscribe((result) => {
//result.items;
});
So I have to pass all the parameters, but if let's say there are 100 parameters, it will be error prone and not good programming style. So it has to take a class object that's it. So is there any way to do the this?