Here you go:
JS [https://drive.google.com/file/d/0BzbrPy41GhA4clQxYW9tRDkyWDg/view?usp=sharing])
HTML [https://drive.google.com/file/d/0BzbrPy41GhA4dWJpVXljdXR2YlU/view?usp=sharing])
Here is my controller code: [https://drive.google.com/file/d/0BzbrPy41GhA4a18tYUN2TkVFWEU/view?usp=sharing])
Here is the JS error:
TypeError: Object doesn't support property or method 'method'
at Anonymous function (http://localhost:6240/Abp/Framework/scripts/libs/abp.jtable.js:53:21)
at Deferred (http://localhost:6240/libs/jquery/jquery.min.js:2:29021)
at self.options.actions.listAction (http://localhost:6240/Abp/Framework/scripts/libs/abp.jtable.js:45:17)
at _reloadTable (http://localhost:6240/libs/jquery-jtable/jquery.jtable.min.js:36:103)
at Anonymous function (http://localhost:6240/libs/jquery-ui/jquery-ui.min.js:6:7939)
at load (http://localhost:6240/libs/jquery-jtable/jquery.jtable.min.js:34:478)
at Anonymous function (http://localhost:6240/libs/jquery-ui/jquery-ui.min.js:6:7939)
at load (http://localhost:6240/libs/jquery-jtable/jquery.jtable.min.js:124:3)
at Anonymous function (http://localhost:6240/libs/jquery-ui/jquery-ui.min.js:6:8911)
at each (http://localhost:6240/libs/jquery/jquery.min.js:2:2876)
I copied an existing Index page from my ABP application that works perfectly. I simply changed the entity name, service name and updated the columns in the JTable grid layout. My controller codes looks exactly the same as the working page code. Yet when this new page runs and you view the index page, it renders fine, but the JTable "Loading" never stops and it never reaches my app service method to get the data. When I look the console in Chrome I see the below error. Can someone please tell me why this error is happening and how to resolve?
[attachment=0:3q3y4tki]Screenshot (25).png[/attachment:3q3y4tki]
I replied to your latest email and I made some more updates to the DTO classes based on your email.
Can you check the updated code and respond to my latest email? I am very much at a standstill due to this issue.
Thanks!
Thanks!
I have emailed you solution for review.
I tried your idea, and set the PK to "long" (Int64) on the DTO and Entity. Still I get the same error?
AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types:
Company -> EditCompanyDto
NursingOps.Company -> NursingOps.Dto.EditCompanyDto
Type Map configuration:
Company -> EditCompanyDto
NursingOps.Company -> NursingOps.Dto.EditCompanyDto
Property:
Contacts ---> AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
Mapping types:
CompanyContact -> EditContactDto
NursingOps.CompanyContact -> NursingOps.Dto.EditContactDto
at lambda_method(Closure , CompanyContact , EditContactDto , ResolutionContext )
at AutoMapper.ResolutionContext.Map[TSource,TDestination](TSource source, TDestination destination)
at lambda_method(Closure , Object , Object , ResolutionContext )
--- End of inner exception stack trace ---
at lambda_method(Closure , Object , Object , ResolutionContext )
at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source)
at AutoMapper.Mapper.Map[TDestination](Object source)
at Abp.AutoMapper.AutoMapExtensions.MapTo[TDestination](Object source) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AutoMapExtensions.cs:line 15
at NursingOps.CompanyAppService.d__9.MoveNext() in \Application\NursingOps\CompanyAppService.cs:line 79
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Threading.InternalAsyncHelper.d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120
--- End of stack...
Can you be more specific on which ones i need to add this to?
I added it to EditContactDto, EditAddressDto and EditCompanyDto. After that I still get the same kind of error, see below.
AutoMapper.AutoMapperMappingException: Error mapping types.
Mapping types:
Company -> EditCompanyDto
NursingOps.Company -> NursingOps.Dto.EditCompanyDto
Type Map configuration:
Company -> EditCompanyDto
NursingOps.Company -> NursingOps.Dto.EditCompanyDto
Property:
Contacts ---> AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.
Mapping types:
CompanyContact -> EditContactDto
NursingOps.CompanyContact -> NursingOps.Dto.EditContactDto
at lambda_method(Closure , CompanyContact , EditContactDto , ResolutionContext )
at AutoMapper.ResolutionContext.Map[TSource,TDestination](TSource source, TDestination destination)
at lambda_method(Closure , Object , Object , ResolutionContext )
--- End of inner exception stack trace ---
at lambda_method(Closure , Object , Object , ResolutionContext )
at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source)
at AutoMapper.Mapper.Map[TDestination](Object source)
at Abp.AutoMapper.AutoMapExtensions.MapTo[TDestination](Object source) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AutoMapExtensions.cs:line 15
at NursingOps.CompanyAppService.d__9.MoveNext() in Application\NursingOps\CompanyAppService.cs:line 79
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Abp.Threading.InternalAsyncHelper.d__5`1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 120
--- End of stack...
Now I have new issue related to this relationship setup.
When the company app service method "GetCompanyForEdit" is called, it returns all the company data plus the addresses and contacts for the selected company. But when the method executes the MapTo<> statement, an exception is thrown.
This file shows all the code and the error message: [https://drive.google.com/open?id=0BzbrPy41GhA4TmoxNnJIeV9IMFk])
By adding the below changes, I was able to make the relationship work. I also did not have to add another migration for this change.
public virtual List<CompanyAddress> Addresses { get; set; }
public virtual List<CompanyContact> Contacts { get; set; }
public Company()
{
Addresses = new List<CompanyAddress>();
Contacts = new List<CompanyContact>();
}
I made the above code change after reading this article: [http://www.entityframeworktutorial.net/code-first/configure-one-to-many-relationship-in-code-first.aspx])