You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
executaveis/GCI.PortalCondomino/wwwroot/js/grid-details.js

41 lines
1.3 KiB
JavaScript

// https://www.aspsnippets.com/Articles/ASPNet-MVC-Master-Detail-example-Display-details-of-Grid-Row-inside-Popup-using-jQuery.aspx
$(function () {
$("[id^='detalhe-recibo']").on('shown.bs.collapse', function () {
var _this = $(this);
var link = $("a[data-target='#" + $(this).attr('id') + "']");
link.removeClass('glyphicon-plus');
link.addClass('glyphicon-minus');
if (!_this.attr('data-cache')) {
var id = link.attr('data-recibo').substr(link.attr('data-recibo').lastIndexOf('-') + 1);
$.ajax({
type: "GET",
url: "/Recibos/Details/" + id,
contentType: "application/json; charset=utf-8",
dataType: "html",
success: function (response) {
_this.html(response);
_this.attr('data-cache', true);
},
failure: function (response) {
_this.html("<p>Ocorreu um erro ao obter detalhes do recibo!</p>");
},
error: function (response) {
_this.html("<p>Ocorreu um erro ao obter detalhes do recibo!</p>");
}
});
}
});
$("[id^='detalhe-recibo']").on('hidden.bs.collapse', function () {
var link = $("a[data-target='#" + $(this).attr('id') + "']");
link.removeClass('glyphicon-minus');
link.addClass('glyphicon-plus');
});
$("#year").on('change', function () {
this.form.submit();
});
});