Open Closed

Custom Entity index.js error #4665


User avatar
0
rkola created

hello im getting js error in the a custom entity index.js page, i have another custom entities but they are working , code above

`$(function () { var l = abp.localization.getResource("testproject");

var neigboorhoodService = window.testproject.Neigboorhoods.Neigboorhoods;

    var lastNpIdId = '';
    var lastNpDisplayNameId = '';

    var _lookupModal = new abp.ModalManager({
        viewUrl: abp.appPath + "Shared/LookupModal",
        scriptUrl: "/Pages/Shared/lookupModal.js",
        modalClass: "navigationPropertyLookup"
    });

    $('.lookupCleanButton').on('click', '', function () {
        $(this).parent().find('input').val('');
    });

    _lookupModal.onClose(function () {
        var modal = $(_lookupModal.getModal());
        $('#' + lastNpIdId).val(modal.find('#CurrentLookupId').val());
        $('#' + lastNpDisplayNameId).val(modal.find('#CurrentLookupDisplayName').val());
    });

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

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

var getFilter = function() {
    return {
        filterText: $("#FilterText").val(),
        name: $("#nameFilter").val(),
		districtId: $("#DistrictIdFilter").val()
    };
};

var dataTable = $("#NeigboorhoodsTable").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(neigboorhoodService.getList, getFilter),
    columnDefs: [
        {
            rowAction: {
                items:
                    [
                        {
                            text: l("Edit"),
                            visible: abp.auth.isGranted('testproject.Neigboorhoods.Edit'),
                            action: function (data) {
                                editModal.open({
                                 id: data.record.neigboorhood.id
                                 });
                            }
                        },
                        {
                            text: l("Delete"),
                            visible: abp.auth.isGranted('testproject.Neigboorhoods.Delete'),
                            confirmMessage: function () {
                                return l("DeleteConfirmationMessage");
                            },
                            action: function (data) {
                                neigboorhoodService.delete(data.record.neigboorhood.id)
                                    .then(function () {
                                        abp.notify.info(l("SuccessfullyDeleted"));
                                        dataTable.ajax.reload();
                                    });
                            }
                        }
                    ]
            }
        },
		{ data: "neigboorhood.name" },
        {
            data: "district.name",
            defaultContent : ""
        }
    ]
}));

createModal.onResult(function () {
    dataTable.ajax.reload();
});

editModal.onResult(function () {
    dataTable.ajax.reload();
});

$("#NewNeigboorhoodButton").click(function (e) {
    e.preventDefault();
    createModal.open();
});

$("#SearchForm").submit(function (e) {
    e.preventDefault();
    dataTable.ajax.reload();
});

$("#ExportToExcelButton").click(function (e) {
    e.preventDefault();

    neigboorhoodService.getDownloadToken().then(
        function(result){
                var input = getFilter();
                var url =  abp.appPath + 'api/app/neigboorhoods/as-excel-file' + 
                    abp.utils.buildQueryString([
                        { name: 'downloadToken', value: result.token },
                        { name: 'filterText', value: input.filterText }, 
                        { name: 'name', value: input.name }, 
                        { name: 'districtId', value: input.districtId }
                        ]);
                        
                var downloadWindow = window.open(url, '_blank');
                downloadWindow.focus();
        }
    )
});

$('#AdvancedFilterSectionToggler').on('click', function (e) {
    $('#AdvancedFilterSection').toggle();
});

$('#AdvancedFilterSection').on('keypress', function (e) {
    if (e.which === 13) {
        dataTable.ajax.reload();
    }
});

$('#AdvancedFilterSection select').change(function() {
    dataTable.ajax.reload();
});

}); `

  • **ABP Framework version:**v6.02
  • UI type: Angular / MVC / Blazor
  • DB provider: EF Core / MSSQL
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:Uncaught TypeError: Cannot read properties of undefined (reading 'Neigboorhoods') at HTMLDocument.<anonymous> (index.js?_v=638138540899034533:4:64) at mightThrow (jquery.js?_v=638091882170120000:3830:29) at process (jquery.js?_v=638091882170120000:3898:12)
  • Steps to reproduce the issue:"

5 Answer(s)
  • User Avatar
    1
    maliming created
    Support Team Fullstack Developer

    hi

    Please check the window.testproject object

  • User Avatar
    0
    rkola created

    thank you but how can i react the testproject object

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What result of your application /Abp/ServiceProxyScript endpoint?

  • User Avatar
    0
    rkola created

    hi i check the /Abp/ServiceProxyScript this endpoint testproject object is okey but testproject.neigboorhoods not , how can i include services into client-proxy i tried generate-proxy but it didnt create neighboorhoods part

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    Please share a template project to reproduce the problem. liming.ma@volosoft.com

Made with ❤️ on ABP v9.1.0-preview. Updated on December 05, 2024, 12:19