I have this JS file:
(function ($) { alert('A'); app.modals.ClassificationTreeModal = function () { var selectedId = []; var _stocktakingSessionsService = abp.services.app.stocktakingSessions; var _modalManager; this.init = function (modalManager) { _modalManager = modalManager; var modal = _modalManager.getModal(); //_$stocktakingSessionInformationForm = _modalManager.getModal().find('form[name=StocktakingSessionInformationsForm]'); //_$stocktakingSessionInformationForm.validate(); }; _stocktakingSessionsService.getClassificationTree( 1, 2 ).done(function (data) { var res1 = JSON.parse(data); $('#jstree').jstree({ core: { data: res1, check_callback: true, "themes": { "variant": "large" } }, "types": { "default": { "icon": "fa fa-folder text-primary" }, "file": { "icon": "fa fa-folder text-primary" } }, 'checkbox': { //keep_selected_style: false, ////whole_node: false, ////tie_selection: true //three_state: false, //cascade: 'none' }, 'search': { 'case_insensitive': true, 'show_only_matches': true }, "plugins": ["search", "wholerow", "checkbox"] }).on('search.jstree', function (nodes, str, res) { if (str.nodes.length === 0) { $('#jstree').jstree(true).hide_all(); } }); $('#deliverable_search').keyup(function () { $('#jstree').jstree(true).show_all(); $('#jstree').jstree('search', $(this).val()); }); $('#jstree').on('changed.jstree', function (e, data) { selectedId = [] for (var i = 0; i < data.selected.length; i++) { selectedId.push(data.instance.get_node(data.selected[i]).id); } }); var inputString = document.getElementById('arrayInput').value; var nodesToCheck = JSON.parse(inputString); $('#jstree').on('loaded.jstree', function () { // Check the node with id '2' nodesToCheck.forEach(function (nodeId) { $('#jstree').jstree('check_node', nodeId.toString()); }); }).fail(function (err) { }); }); this.save = function () { var arr = selectedId var data = { arr2: selectedId, }; _modalManager.setResult(data); abp.event.trigger('app.ClassificationTreeStocktakingSessionModalSaved', data); abp.notify.info(app.localize('SavedSuccessfully')); _modalManager.close(); }; } })(jQuery); I am loading the JS file:
@section Scripts { <script abp-src="/view-resources/Areas/App/Views/StocktakingSessions/_ClassificationTreeModel.js" asp-append-version="true"></script> } but alert('A'); not firing. Any reason?
abp-srcin ASP.NET or ASP.NET Core. I see ABP uses abp-script to load bundled/minified files. Is that what you wanted to do?