Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*---------------------------------------------------------*/
- /* Muestra una Ventana Modal Con Clientes para seleccionar */
- /*=========================================================*/
- buscarCliente = function(){
- var cmdModal = $("#buscar").on("click", function () {
- $('#modBuscaCliente').modal({show: true});
- $('#tBusqueda').DataTable().destroy();
- var table = $('#tBusqueda').DataTable({
- "destroy": true,
- "ajax": {
- "method": "get",
- "url": "/buscacliente/"
- },
- "language": {"url": "/json/datatables/Spanish.json"},
- "lengthMenu": [[5, 10], [5, 10]],
- "columns": [
- {"data": "nrocliente"},
- {"data": "cliente"},
- {"data": "domicilio"},
- {
- "defaultContent": "<button type='button' class='selec btn btn-primary sm'></button>",
- "className": "text-center"
- }
- ],
- "columnDefs": [
- {"bSortable": false, "targets": 3}, {"width": "10%", "targets": [0]},
- {"title": "N°", className: "center", "targets": [0]}
- /*{ "title": "S", className: "center", "targets": [3]}*/
- ]
- });
- obtenerDatosCliente("#tBusqueda tbody",table);
- })
- /*==================================================================*/
- var obtenerDatosCliente = function(tbody,table){
- $(tbody).on("click","button.selec", function(){
- var datos = table.row($(this).parents("tr")).data();
- console.log( datos );
- var idCliente = $("#idCliente").val(datos.idcliente),
- cliente = $("#txtCliente").val(datos.cliente),
- nroCliente = $("#txtNroCliente").val(datos.nrocliente),
- domicilio = $("#txtDireccion").val(datos.domicilio);
- });
- }
- /*===================================================================*/
- } // Fin Buscar Cliente
Add Comment
Please, Sign In to add comment