Check the docs before asking a question: https://abp.io/docs/latest
Check the samples to see the basic tasks: https://abp.io/docs/latest/samples
The exact solution to your question may have been answered before, and please first use the search on the homepage.
Provide us with the following info:
🧐 Hint: If you are using the ABP Studio, you can see all the information about your solution from the configuration window, which opens when you right-click on the solution and click on the Solution Configuration
button.
- ABP Framework version: v8.2.3
- UI Type: MVC
- Database System: EF Core (MySQL.)
- Tiered (for MVC) or Auth Server Separated (for Angular): no
- Exception message and full stack trace:
- Steps to reproduce the issue:
Hello ABP team,
I have a value in my list view, which I am trying to look-up with an unbound list in javascript, however it is not working, could you please help me with this code:
{ data: "licenseTypeId",
render: function(licenseTypeId)
{
var newresult;
window.techDB.baseLicense.licenseSubscriptions.licenseSubscription.getLicenseTypeLookup()
.then(function(licenseTypes){
var licenseType = licenseTypes.items.find(type => type.id === licenseTypeId);
newresult = licenseType.licenseName;
return licenseType;
});
return newresult;
}
}
full code for datatable is :
var dataTableColumns = [
{
rowAction: {
items:
[
{
text: l("Edit"),
visible: abp.auth.isGranted('BaseLicense.LicenseSubscriptions.Edit'),
action: function (data) {
editModal.open({
id: data.record.id
});
}
},
{
text: l("Delete"),
visible: abp.auth.isGranted('BaseLicense.LicenseSubscriptions.Delete'),
confirmMessage: function () {
return l("DeleteConfirmationMessage");
},
action: function (data) {
licenseSubscriptionService.delete(data.record.id)
.then(function () {
abp.notify.success(l("SuccessfullyDeleted"));
dataTable.ajax.reloadEx();;
});
}
}
]
},
width: "1rem"
},
{ data: "licenseKey" },
{
data: "isActive",
render: function (isActive) {
return isActive ? '<i class="fa fa-check"></i>' : '<i class="fa fa-times"></i>';
}
},
{ data: "licenseTypeId",
render: function(licenseTypeId)
{
var newresult;
window.techDB.baseLicense.licenseSubscriptions.licenseSubscription.getLicenseTypeLookup()
.then(function(licenseTypes){
var licenseType = licenseTypes.items.find(type => type.id === licenseTypeId);
newresult = licenseType.licenseName;
return licenseType;
});
return newresult;
}
}
];
Many thanks, Navneet
15 Answer(s)
-
0
Hi,
Could you please share a minimal reproducible project with me? I will check it. shiwei.liang@volosoft.com
-
0
Hi Shiwei,
I have sent you a sample when you run the project, first, create an author, note down the author's Guid Id second, create a book and add name and above Guid Id.
the expected result when you the project and navigate to Booklist view, you should be able to see "Book Name", "Author ID" and "AuthorName".
Sorry I am not good at Javascript (I am dotnet developer).
Thanks Nav
-
0
Hi Shiwei,
looks like I am not able to send you an email due to a bounce back with the below error:-
Sorry, we were unable to deliver your message to the following address. <shiwei.liang@volosoft.com>: 552: 5.7.0 This message was blocked because its content presents a potential 5.7.0 security issue. To review our message content and attachment content 5.7.0 guidelines, go to 5.7.0 https://support.google.com/mail/?p=BlockedMessage d75a77b69052e-4607b4c88f0si7119331cf.597 - gsmtp
-
0
Hi,
You can share it with https://wetransfer.com/
-
0
Hi Liangshiwei,
I have sent you another email with a link to download
many thx, Nav
-
0
Hi,
because the HTTP Request is async. you can try this
//<suite-custom-code-block-1> var _authors; window.acme.bookStore.books.books.getAuthorLookup() .then(function(authors){ _authors = authors; }); //</suite-custom-code-block-1> ......... { data: "authorName", render: function(authorID) { return _authors.items.find(type => type.id === authorID).firstname; } }
-
0
Thanks Liangshiwei, it is not giving the result I am looking for, it is just repeating the same author-name
Liangshiwei, is there a way I can ignore JavaScript and use c# to display the book list view? As in c#, there is a for each loop that I can use to look at the Author.
I tried to check ABP-Samples in MVC; all are using JavaScript to show a list view
Many thx, Navneet
-
0
Liangshiwei, is there a way I can ignore JavaScript and use c# to display the book list view? As in c#, there is a for each loop that I can use to look at the Author.
Yes, you can check this document:
https://abp.io/docs/latest/suite/generating-crud-page#step-by-step-creating-a-navigation-property-with-1-to-many-relat
-
0
Hi Liangshiwei,
Sorry if I am not very clear, but
- It's not a bound column as one-to-many navigation
- When I use Suite, it creates code in Javascript for list view, not c#
-
0
When I use Suite, it creates code in Javascript for list view, not c#
yes, Suite always uses JS to load the view because the list needs to be loaded asynchronously .
-
0
Thanks Liangshiwei, it is not giving the result I am looking for, it is just repeating the same author-name
This is because the look-up result doesn't have ID property
Add
ID
toAuthorLookupDto
Update JS
render: function(data, type, row, meta) { return _authors.items.find(type => type.id === row.authorID).firstname; }
-
0
Many thx Liangshiwei,
Javascript is now working 😀
I wonder if ABP.io will look to develop c# based asynchronously so that it can be fully c# based same as what ABP suite creates code for CreateModel and UpdateModel.
Thanks again Navneet
-
0
Hi,
I wonder if ABP.io will look to develop c# based asynchronously so that it can be fully c# based same as what ABP suite creates code for CreateModel and UpdateModel.
Unfortunately not, because the table needs to refresh and search, need to use js to operate DOM
-
0
Thanks for your help.
We can close this ticket.
Quick question: I am getting an error while downloading IdentityServer.Pro module: I know it is discontinued however, one of my clients is still using it
**abp get-source Volo.Abp.IdentityServer.Pro** [22:37:18 ERR] Downloading source code failed for: Volo.Abp.IdentityServer.Pro Volo.Abp.Studio.AbpStudioException: Exception of type 'Volo.Abp.Studio.AbpStudioException' was thrown. at async Task Volo.Abp.Studio.Modules.Installing.SourceCodeDownloader.DownloadSourceCodeAsync(string moduleName, string targetFolder, string version, bool includeNightly) at async Task Volo.Abp.Studio.Cli.Commands.StudioGetSourceCommand.ExecuteAsync(CommandLineArgs commandLineArgs ) at async Task Volo.Abp.Studio.Cli.StudioCliService.RunInternalAsync(CommandLineArgs commandLineArgs) at async Task Volo.Abp.Studio.Cli.StudioCliService.RunAsync(string[] args)
Thanks, Bye
-
0
Quick question: I am getting an error while downloading IdentityServer.Pro module: I know it is discontinued however, one of my clients is still using it
It looks like a problem, we will fix it soon.