Base solution for your next web application
Open Closed

Create Modal Scripts Not Firing #3249


User avatar
0
jdavis01 created

So I posted having a problem earlier with the ASPNet.core MVC & JQuery version 4.0.0 and thought that syntax was the issue however i have the same problem again. Here is what I am doing.

I copy the _empty.js file from the view-resources/areas/app/views/common/modals/empty to lets say a Suppliers folder (view-resources/areas/app/views/common/modals/suppliers/)

I rename the _empty.js file to _CreateSupplierModal.js and paste the following code

(function () {
    var _createSupplierModal = new app.ModalManager({
        viewUrl: abp.appPath + 'App/Suppliers/CreateSupplierModal',
        scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Suppliers/_CreateSupplierModal.js',
        modalClass: 'CreateSupplierModal'
    });

    // Grab the person service for CRUD Operations
    var _supplierService = abp.services.app.supplier;

    //Create person button
    $('#CreateNewSupplierButton').click(function (e) {
        e.preventDefault();
        _createSupplierModal.open();
    });

})();

this modal will not fire. I have to create a new javascript file and name it something like _CreateSupplierModalWindow and use this code it works fine.

(function () {
    var _createSupplierModal = new app.ModalManager({
        viewUrl: abp.appPath + 'App/Suppliers/CreateSupplierModal',
        scriptUrl: abp.appPath + 'view-resources/Areas/App/Views/Suppliers/_CreateSupplierModalWindow.js',
        modalClass: 'CreateSupplierModal'
    });

    // Grab the person service for CRUD Operations
    var _supplierService = abp.services.app.supplier;

    //Create person button
    $('#CreateNewSupplierButton').click(function (e) {
        e.preventDefault();
        _createSupplierModal.open();
    });

})();

I have tried to delete the tainted files and re-create them but it does not work. I didn't have any problems whatsoever of this nature using Visual Studio 2015 and MVC5 version.

What are your thoughts and am I overlooking something.


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @jdavis01,

    Actually I couldn't think of any reason at the moment. If you can share your project with not opening modal, we can take a look at it to find problem.

    Thanks.

  • User Avatar
    0
    jdavis01 created

    I moved it to a private repo and added you

    <a class="postlink" href="https://github.com/joedavis01/scratchPad">https://github.com/joedavis01/scratchPad</a>