Open Closed

a CRUD page bug #8959


User avatar
0
LiSong created
  • ABP Framework version: v9.X.X

  • UI Type: MVC / Blazor WASM / Blazor Server

  • Database System: SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB

  • Tiered (for MVC) or Auth Server Separated (for Angular): no

  • Exception message and full stack trace:

  • Steps to reproduce the issue:

There is a bug that has existed since we started using ABP a year ago. Every time we modify a CRUD page and regenerate the list page (which uses the index.js file), this bug appears. We have an entity called TappProgram that has a child entity named TappProjects. The generated code always includes the incorrect code shown below,

    var tappProjectService = window.tapp.dataHub.TappProjects.tappProjects;

whereas the correct code should be as follows:

        var tappProjectService = window.tapp.dataHub.tappProjects.tappProjects;

with lowercase t,

it's in this funciton:

function initDataGrids(data) {
        initTappProjectGrid(data)
    }
    
        function initTappProjectGrid(data) {
        if(!abp.auth.isGranted("Tapp.TappProjects")) {
            return;
        }
        
        var tappProgramId = data.tappProgram.id;

        
        var tappProjectService = window.tapp.dataHub.tappProjects.tappProjects;

        var tappProjectCreateModal = new abp.ModalManager({
            viewUrl: abp.appPath + "TappProjects/CreateModal",
            scriptUrl: abp.appPath + "Pages/TappProjects/createModal.js",
            modalClass: "tappProjectCreate"
        });

        var tappProjectEditModal = new abp.ModalManager({
            viewUrl: abp.appPath + "TappProjects/EditModal",
            scriptUrl: abp.appPath + "Pages/TappProjects/editModal.js",
            modalClass: "tappProjectEdit"
        });

        var tappProjectDataTable = $("#TappProjectsTable-" + tappProgramId).DataTable(abp.libs.datatables.normalizeConfiguration({
            processing: true,
            serverSide: true,
            paging: true,
            searching: false,
            scrollX: true,
            autoWidth: true,
            scrollCollapse: true,
            order: [[1, "asc"]],
            ajax: abp.libs.datatables.createAjax(tappProjectService.getListByTappProgramId, {
                tappProgramId: tappProgramId,
                maxResultCount: 5
            }),
            columnDefs: [
                {
                    rowAction: {
                        items:
                            [
                                {
                                    text: l("Edit"),
                                    visible: abp.auth.isGranted('Tapp.TappProjects.Edit'),
                                    action: function (data) {
                                        tappProjectEditModal.open({
                                            id: data.record.id
                                        });
                                    }
                                    

the error causes a front end issue, and the create new button will be broken.

How can we avoid this situation?

Could you fix this issue?


6 Answer(s)
  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Thanks for reporting,

    I'll deliver this issue to the ABP Suite team

    Since it's a bug your ticket is refunded

  • User Avatar
    0
    yekalkan created
    Support Team Fullstack Developer

    I could not reproduce the problem.

    image.png

    Every time we modify a CRUD page and regenerate the list page (which uses the index.js file), this bug appears

    Could you provide more details?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    Our team could not reproduce the problem. Can you share your AppService or Controller endpoint code in C#?

  • User Avatar
    0
    LiSong created

    > Can you share your AppService or Controller endpoint code in C#?

    yes, which one do you want me to share?

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    yes, which one do you want me to share?

    You can send the ApplicationService interface, its implementation, and the content of your Controller if you have created one.

  • User Avatar
    0
    LiSong created

    sorry do you mean this interface? I didn't create a new controller, I just created the CRUD pages using abp suite
    public partial interface ITappProjectsAppService
    {
    //Write your custom code here...
    }

    public class TappProjectsAppService : TappProjectsAppServiceBase, ITappProjectsAppService
    {
        //<suite-custom-code-autogenerated>
        public TappProjectsAppService(ITappProjectRepository tappProjectRepository, TappProjectManager tappProjectManager)
            : base(tappProjectRepository, tappProjectManager)
        {
        }
        //</suite-custom-code-autogenerated>
    
        //Write your custom code...
    }
    

    using System;
    using System.IO;
    using System.Linq;
    using System.Collections.Generic;
    using System.Threading.Tasks;
    using System.Linq.Dynamic.Core;
    using Microsoft.AspNetCore.Authorization;
    using Volo.Abp;
    using Volo.Abp.Application.Dtos;
    using Volo.Abp.Application.Services;
    using Volo.Abp.Domain.Repositories;
    using Tapp.Permissions;
    using Tapp.DataHub.TappProjects;

    namespace Tapp.DataHub.TappProjects
    {

    [Authorize(TappPermissions.TappProjects.Default)]
    public abstract class TappProjectsAppServiceBase : TappAppService
    {
    
        protected ITappProjectRepository _tappProjectRepository;
        protected TappProjectManager _tappProjectManager;
    
        public TappProjectsAppServiceBase(ITappProjectRepository tappProjectRepository, TappProjectManager tappProjectManager)
        {
    
            _tappProjectRepository = tappProjectRepository;
            _tappProjectManager = tappProjectManager;
    
        }
    
        public virtual async Task<PagedResultDto<TappProjectDto>> GetListByTappProgramIdAsync(GetTappProjectListInput input)
        {
            var tappProjects = await _tappProjectRepository.GetListByTappProgramIdAsync(
                input.TappProgramId,
                input.Sorting,
                input.MaxResultCount,
                input.SkipCount);
    
            return new PagedResultDto<TappProjectDto>
            {
                TotalCount = await _tappProjectRepository.GetCountByTappProgramIdAsync(input.TappProgramId),
                Items = ObjectMapper.Map<List<TappProject>, List<TappProjectDto>>(tappProjects)
            };
        }
    
        public virtual async Task<PagedResultDto<TappProjectDto>> GetListAsync(GetTappProjectsInput input)
        {
            var totalCount = await _tappProjectRepository.GetCountAsync(input.FilterText, input.Name, input.Country, input.State, input.Region, input.Municipality, input.TimeZoneMin, input.TimeZoneMax, input.Description, input.Tags);
            var items = await _tappProjectRepository.GetListAsync(input.FilterText, input.Name, input.Country, input.State, input.Region, input.Municipality, input.TimeZoneMin, input.TimeZoneMax, input.Description, input.Tags, input.Sorting, input.MaxResultCount, input.SkipCount);
    
            return new PagedResultDto<TappProjectDto>
            {
                TotalCount = totalCount,
                Items = ObjectMapper.Map<List<TappProject>, List<TappProjectDto>>(items)
            };
        }
    
        public virtual async Task<TappProjectDto> GetAsync(Guid id)
        {
            return ObjectMapper.Map<TappProject, TappProjectDto>(await _tappProjectRepository.GetAsync(id));
        }
    
        [Authorize(TappPermissions.TappProjects.Delete)]
        public virtual async Task DeleteAsync(Guid id)
        {
            await _tappProjectRepository.DeleteAsync(id);
        }
    
        [Authorize(TappPermissions.TappProjects.Create)]
        public virtual async Task<TappProjectDto> CreateAsync(TappProjectCreateDto input)
        {
    
            var tappProject = await _tappProjectManager.CreateAsync(input.TappProgramId
            , input.TimeZone, input.Name, input.Country, input.State, input.Region, input.Municipality, input.Description, input.Tags
            );
    
            return ObjectMapper.Map<TappProject, TappProjectDto>(tappProject);
        }
    
        [Authorize(TappPermissions.TappProjects.Edit)]
        public virtual async Task<TappProjectDto> UpdateAsync(Guid id, TappProjectUpdateDto input)
        {
    
            var tappProject = await _tappProjectManager.UpdateAsync(
            id, input.TappProgramId
            , input.TimeZone, input.Name, input.Country, input.State, input.Region, input.Municipality, input.Description, input.Tags
            );
    
            return ObjectMapper.Map<TappProject, TappProjectDto>(tappProject);
        }
    }
    

    }

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 18, 2025, 10:42