@{
ViewData["Title"] = "Lista de SubCategorías";
}
<div class="container mt-4">
<div class="row">
<div class="col-8">
<h2 class="text-primary">Lista de SubCategorías</h2>
</div>
<div class="col-4 text-right">
<a asp-action="Create" class="btn btn-primary"><i class="fa-solid fa-plus"></i> Crear Nueva SubCategoría</a>
</div>
</div>
<br />
<br />
<table id="tblSubCategorias" class="table table-striped table-bordered" style="width: 100%">
<thead>
<tr>
<th class="text-center">Id</th>
<th class="text-center">Categoría</th>
<th class="text-center">Nombre</th>
</tr>
</thead>
</table>
</div>
@section Scripts {
<script src="~/js/subCategoria.js"></script>
}
body {
font: 90%/1.45em "Helvetica Neue", HelveticaNeue, Verdana, Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
color: #333;
background-color: #fff;
}
var dataTable;
$(document).ready(function () {
cargarDataTable();
});
function cargarDataTable() {
dataTable = $("#tblSubCategorias").DataTable({
"ajax": {
"url": "/admin/subcategorias/GetAll",
"type": "POST",
"datatype": "json"
},
"processing": true,
"serverSide": true,
"pageLength": 10,
"filter": true,
"data": null,
"responsive": true,
"columns": [
//{ "data": "id", "width": "5%" },
//{ "data": "url", "width": "40%" },
//{ "data": "descripcion", "width": "10%" },
{ "data": "id", "autoWidth": true },
{ "data": "categoria.nombre", "autoWidth": true },
{ "data": "nombre", "autoWidth": true },
],
"language": {
"decimal": "",
"emptyTable": "No hay registros",
"info": "Mostrando _START_ a _END_ de _TOTAL_ Entradas",
"infoEmpty": "Mostrando 0 de 0 de un total de 0 Entradas",
"infoFiltered": "(Filtrado de _MAX_ total entradas)",
"infoPostFix": "",
"thousands": ",",
"lengthMenu": "Mostrar _MENU_ Entradas",
"loadingRecords": "Cargando...",
"processing": "Procesando...",
"search": "Buscar:",
"zeroRecords": "Sin resultados encontrados",
"paginate": {
"first": "Primero",
"last": "Ultimo",
"next": "Siguiente",
"previous": "Anterior"
}
},
"width": "100%"
});
}
function Delete(url) { /*ESTE METODO ES EL QUE SE LLAMA DESDE EL BOTON DE BORRAR DEL DATATABLE (QUE ESTÁ MÁS ARRIBA)*/
swal({
title: "¿Está seguro de borrar?",
text: "¡Este contenido no se puede recuperar!",
type: "warning",
showCancelButton: true,
cancelButtonText: "Cancelar",
confirmButtonColor: "#DD6B55",
confirmButtonText: "Si, ¡borrar!",
closeOnconfirm: true
}, function () {
$.ajax({
type: 'DELETE', /*esto es la llamada al metodo que está en el controller*/
url: url,
success: function (data) {
if (data.success) {
toastr.success(data.message);
dataTable.ajax.reload();
}
else {
toastr.error(data.message);
}
}
});
toastr.options = {
//primeras opciones
"closeButton": false, //boton cerrar
"debug": false,
"newestOnTop": false, //notificaciones mas nuevas van en la parte superior
"progressBar": false, //barra de progreso hasta que se oculta la notificacion
"preventDuplicates": false, //para prevenir mensajes duplicados
"onclick": null,
//Posición de la notificación
//toast-bottom-left, toast-bottom-right, toast-bottom-left, toast-top-full-width, toast-top-center
"positionClass": "toast-top-center",
"showDuration": "300",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut",
"tapToDismiss": false,
};
});
}
This bin was created anonymously and its free preview time has expired. Get a free unrestricted account
Dismiss xShortcut | Action |
---|---|
ctrl + [num] | Toggle nth panel |
ctrl + 0 | Close focused panel |
ctrl + enter | Re-render output. If console visible: run JS in console |
Ctrl + l | Clear the console |
ctrl + / | Toggle comment on selected lines |
ctrl + [ | Indents selected lines |
ctrl + ] | Unindents selected lines |
tab | Code complete & Emmet expand |
ctrl + s | Save & lock current Bin from further changes |
ctrl + shift + s | Clone Bin |
ctrl + y | Archive Bin |
Complete list of JS Bin shortcuts |
URL | Action |
---|---|
/ | Show the full rendered output. This content will update in real time as it's updated from the /edit url. |
/edit | Edit the current bin |
/watch | Follow a Code Casting session |
/embed | Create an embeddable version of the bin |
/latest | Load the very latest bin (/latest goes in place of the revision) |
/[username]/last | View the last edited bin for this user |
/[username]/last/edit | Edit the last edited bin for this user |
/[username]/last/watch | Follow the Code Casting session for the latest bin for this user |
/quiet | Remove analytics and edit button from rendered output |
.js | Load only the JavaScript for a bin |
.css | Load only the CSS for a bin |
Except for username prefixed urls, the url may start with http://jsbin.com/abc and the url fragments can be added to the url to view it differently. |