Guest User

Untitled

a guest
Jan 17th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. /*---------------------------------------------------------*/
  2. /* Muestra una Ventana Modal Con Clientes para seleccionar */
  3. /*=========================================================*/
  4. buscarCliente = function(){
  5. var cmdModal = $("#buscar").on("click", function () {
  6. $('#modBuscaCliente').modal({show: true});
  7. $('#tBusqueda').DataTable().destroy();
  8. var table = $('#tBusqueda').DataTable({
  9. "destroy": true,
  10. "ajax": {
  11. "method": "get",
  12. "url": "/buscacliente/"
  13. },
  14. "language": {"url": "/json/datatables/Spanish.json"},
  15. "lengthMenu": [[5, 10], [5, 10]],
  16. "columns": [
  17. {"data": "nrocliente"},
  18. {"data": "cliente"},
  19. {"data": "domicilio"},
  20. {
  21. "defaultContent": "<button type='button' class='selec btn btn-primary sm'></button>",
  22. "className": "text-center"
  23. }
  24. ],
  25. "columnDefs": [
  26. {"bSortable": false, "targets": 3}, {"width": "10%", "targets": [0]},
  27. {"title": "N&#176;", className: "center", "targets": [0]}
  28. /*{ "title": "S", className: "center", "targets": [3]}*/
  29. ]
  30. });
  31. obtenerDatosCliente("#tBusqueda tbody",table);
  32. })
  33. /*==================================================================*/
  34. var obtenerDatosCliente = function(tbody,table){
  35. $(tbody).on("click","button.selec", function(){
  36. var datos = table.row($(this).parents("tr")).data();
  37. console.log( datos );
  38.  
  39. var idCliente = $("#idCliente").val(datos.idcliente),
  40. cliente = $("#txtCliente").val(datos.cliente),
  41. nroCliente = $("#txtNroCliente").val(datos.nrocliente),
  42. domicilio = $("#txtDireccion").val(datos.domicilio);
  43. });
  44. }
  45. /*===================================================================*/
  46. } // Fin Buscar Cliente
Add Comment
Please, Sign In to add comment