Anonymous
Почему предупреждение не работает в JS-файле платформы ABP?
Сообщение
Anonymous » 21 ноя 2025, 13:46
У меня есть этот файл JS:
Код: Выделить всё
(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);
Я загружаю файл JS:
но alert('A'); не срабатывает. Есть причина?
Подробнее здесь:
https://stackoverflow.com/questions/798 ... rk-js-file
1763721967
Anonymous
У меня есть этот файл JS: [code](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); [/code] Я загружаю файл JS: [code]@section Scripts { } [/code] но alert('A'); не срабатывает. Есть причина? Подробнее здесь: [url]https://stackoverflow.com/questions/79826407/why-is-alert-not-working-in-abp-framework-js-file[/url]