Función para crear automáticamente el código de la vista en base a una tabla en MySQL
Ahora solo queda hacer la función para generar automáticamente el código HTML/PHP para la vista del catalogo en base a la nueva tabla.
La lógica es igual solo que es otro texto
Creamos el modulo creadorVista en la carpeta
Insertamos el siguiente código
' Gambas module file Public Function creaVista() As String Dim strVista As String Dim conexion As New Connection Dim strDatos As String With conexion .Type = "mysql" .Port = "3306" .Host = Settings["servidor"] .User = Settings["usuario"] .Password = Settings["password"] .Name = Settings["baseDeDatos"] .Open() End With Dim $result As Result Dim $resultClases As Result Dim strLLavePrimaria As String $result = conexion.Exec("SHOW KEYS FROM " & FMain.txtTabla.Text & " WHERE Key_name = 'PRIMARY'") strLLavePrimaria = $result["Column_name"] conexion.Exec("delete from clases where clase= 'controladores/" & FMain.txtTabla.Text & ".controlador.php'") conexion.Exec("delete from clases where clase= 'modelos/" & FMain.txtTabla.Text & ".modelo.php'") conexion.Exec("insert into clases(clase) values('controladores/" & FMain.txtTabla.Text & ".controlador.php')") conexion.Exec("insert into clases(clase) values( 'modelos/" & FMain.txtTabla.Text & ".modelo.php')") $result = conexion.Exec("describe " & FMain.txtTabla.Text) $result = conexion.Exec("describe " & FMain.txtTabla.Text) Dim contador As Integer Dim strEncabezadosTabla As String Dim strCampos As String Dim strControlesNuevos As String Dim strControlesEditar As String Dim strEditarJS As String Dim strBloquear As String Dim strEditarTraeDatos As String contador = 0 strEncabezadosTabla = "" strCampos = "" strControlesNuevos = "" strEditarJS = "" While $result.Length > contador strEncabezadosTabla &= "<th>" & utilerias.strPrimeraMayuscula($result["Field"]) & "</th>" & gb.CrLf strCampos &= "<td>'.$value[\"" & $result["Field"] & "\"].'</td>" & gb.CrLf If contador > 0 strControlesNuevos &= "" & " <!-- ENTRADA PARA " & UCase($result["Field"]) & " --> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " <div class=\"form-group\"> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " <div class=\"input-group\"> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " <span class=\"input-group-addon\">" & utilerias.strPrimeraMayuscula($result["Field"]) & ": </span> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " <input type=\"text\" class=\"form-control input-lg\" name=\"nuevo" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" placeholder=\"Ingresar " & utilerias.strPrimeraMayuscula($result["Field"]) & "\" required> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " </div> " & gb.CrLf strControlesNuevos &= "" & " " & gb.CrLf strControlesNuevos &= "" & " </div> " & gb.CrLf strEditarJS &= "" & " $(\"#editarDescripcion\").val(respuesta[\"descripcion\"]);" & gb.CrLf End If If $result["Key"] == "PRI" strBloquear = "readonly" Else strBloquear = "" End If strControlesEditar &= "" & " <!-- ENTRADA PARA " & UCase($result["Field"]) & " --> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " <div class=\"form-group\"> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " <div class=\"input-group\"> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " <span class=\"input-group-addon\">" & utilerias.strPrimeraMayuscula($result["Field"]) & ": </span> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " <input " & strBloquear & " type=\"text\" class=\"form-control input-lg\" id=\"editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" name=\"editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\" placeholder=\"Ingresar " & utilerias.strPrimeraMayuscula($result["Field"]) & "\" required> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " </div> " & gb.CrLf strControlesEditar &= "" & " " & gb.CrLf strControlesEditar &= "" & " </div> " & gb.CrLf strEditarTraeDatos &= "" & " $(\"#editar" & utilerias.strPrimeraMayuscula($result["Field"]) & "\").val(respuesta[\"" & $result["Field"] & "\"]); " & gb.CrLf $result.MoveNext contador = contador + 1 Wend strControlesEditar &= "" & " <input type=\"hidden\" id=\"editar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\" name = \"editar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\" > " & gb.CrLf strEncabezadosTabla &= "<th>Acciones</th>" strCampos &= "<td> " & gb.CrLf strCampos &= "<div class = \"btn-group\"> " & gb.CrLf strCampos &= " <button class= \"btn btn-warning btnEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & " = \"'.$value[\"id\"].'\" data-toggle = \"modal\" data-target = \"#modalEditar" & Trim(utilerias.strPrimeraMayuscula(FMain.txtTabla.Text)) & "\"> <i class = \"fa fa-pencil\"> </i> </button> " & gb.CrLf strCampos &= "<button class = \"btn btn-danger btnEliminar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "= \"'.$value[\"id\"].'\"><i class= \"fa fa-times\"></i></button>" & gb.CrLf strCampos &= "</div>" & gb.CrLf strCampos &= "</td> " & gb.CrLf strVista &= "" & "<?php" & gb.CrLf strVista &= "" & gb.CrLf strVista &= "" & "if(\"off\" == \"offf\"){" & gb.CrLf strVista &= "" & gb.CrLf strVista &= "" & " echo '<script>" & gb.CrLf strVista &= "" & gb.CrLf strVista &= "" & " window.location = \"inicio\"; " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </script>'; " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " return; " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "} " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "?> " & gb.CrLf strVista &= "" & "<div class=\"content-wrapper\">" & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <section class=\"content-header\">" & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <h1> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " Administrar <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </h1> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <ol class=\"breadcrumb\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <li><a href=\"inicio\"><i class=\"fa fa-dashboard\"></i> Inicio</a></li> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <li class=\"active\">Administrar <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', '" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?></li> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </ol> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </section> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <section class=\"content\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"box\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"box-header with-border\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button class=\"btn btn-primary\" data-toggle=\"modal\" data-target=\"#modalAgregar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " Agregar <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', '" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"box-body\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <table class=\"table table-bordered table-striped dt-responsive tablas\" width=\"100%\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <thead> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <tr> " & gb.CrLf strVista &= "" & " " & strEncabezadosTabla strVista &= "" & " </tr> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </thead> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <tbody> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <?php " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " $item = null; " & gb.CrLf strVista &= "" & " $valor = null; " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " $" & FMain.txtTabla.Text & "= Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "::ctrMostrar($item, $valor); " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " foreach ($" & FMain.txtTabla.Text & " as $key => $value){ " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " echo ' <tr> " & gb.CrLf strVista &= "" & strCampos & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </tr>'; " & gb.CrLf strVista &= "" & " } " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " ?> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </tbody> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </table> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </section> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "</div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "<!--===================================== " & gb.CrLf strVista &= "" & "MODAL <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "<div id=\"modalAgregar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "\" class=\"modal fade\" role=\"dialog\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-dialog\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-content\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <form role=\"form\" method=\"post\" enctype=\"multipart/form-data\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " CABEZA DEL MODAL " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-header\" style=\"background:#3c8dbc; color:white\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <h4 class=\"modal-title\">Agregar <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> </h4> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " CUERPO DEL MODAL " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-body\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"box-body\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf 'strVista &= "" & " <!-- ENTRADA PARA DESCRIPCION --> " & gb.CrLf strVista &= "" & " " & strControlesNuevos & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " PIE DEL MODAL " & gb.CrLf strVista &= "" & " ====================================== --> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-footer\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"button\" class=\"btn btn-default pull-left\" data-dismiss=\"modal\">Salir</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"submit\" class=\"btn btn-primary\">Guardar</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <?php " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " $crear = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "(); " & gb.CrLf strVista &= "" & " $crear ->ctrIngresar(); " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " ?> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </form> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "</div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "<!--===================================== " & gb.CrLf strVista &= "" & "MODAL EDITAR USUARIO " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "<div id=\"modalEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\" class=\"modal fade\" role=\"dialog\">" & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-dialog\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-content\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <form role=\"form\" method=\"post\" enctype=\"multipart/form-data\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " CABEZA DEL MODAL " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-header\" style=\"background:#3c8dbc; color:white\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"button\" class=\"close\" data-dismiss=\"modal\">×</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <h4 class=\"modal-title\">Agregar <?php echo mb_strtolower(preg_replace('/(?<=\\w)(\\p{Lu})/u', ' $1', ' " & (FMain.txtTabla.Text) & " ')); ?> </h4> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " CUERPO DEL MODAL " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-body\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"box-body\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!-- ENTRADA PARA DESCRIPCION --> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & strControlesEditar strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <!--===================================== " & gb.CrLf strVista &= "" & " PIE DEL MODAL " & gb.CrLf strVista &= "" & " ======================================--> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <div class=\"modal-footer\"> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"button\" class=\"btn btn-default pull-left\" data-dismiss=\"modal\">Salir</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <button type=\"submit\" class=\"btn btn-primary\">Modificar</button> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " <?php " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " $editar = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.text) & "(); " & gb.CrLf strVista &= "" & " $editar ->ctrEditar(); " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " ?> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </form> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " </div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "</div> " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "<?php " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " $borrar = new Controlador" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "(); " & gb.CrLf strVista &= "" & " $borrar ->ctrBorrar(); " & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "?> " & gb.CrLf 'JAVASCRIPT FUNCIONES strVista &= "" & "<script type=\"text/javascript\">" & gb.CrLf 'ELIMINAR strVista &= "" & "/*= == == == == == == == == == == == == == == == == == == == == == ==" & gb.CrLf strVista &= "" & " ELIMINAR " & UCase(FMain.txtTabla.Text) & gb.CrLf strVista &= "" & " == == == == == == == == == == == == == == == == == == == == == == = */" & gb.CrLf strVista &= "" & "$(\".tablas\").on(\"click\", \".btnEliminar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", function() {" & gb.CrLf strVista &= "" & " var id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " = $(this).attr(\"id" & FMain.txtTabla.Text & "\");" & gb.CrLf strVista &= "" & " swal( {" & gb.CrLf strVista &= "" & " title: '¿Está seguro de borrar?'," & gb.CrLf strVista &= "" & " text: \"¡Si no lo está puede cancelar la accíón!\"," & gb.CrLf strVista &= "" & " type: 'warning'," & gb.CrLf strVista &= "" & " showCancelButton: true," & gb.CrLf strVista &= "" & " confirmButtonColor: '#3085d6'," & gb.CrLf strVista &= "" & " cancelButtonColor: '#d33'," & gb.CrLf strVista &= "" & " cancelButtonText: 'Cancelar'," & gb.CrLf strVista &= "" & " confirmButtonText: 'Si, borrar!'" & gb.CrLf strVista &= "" & " }).then(function(result) {" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " if (result.value) {" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " window.location = \"index.php?ruta=" & (FMain.txtTabla.Text) & "&id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "=\"+id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "+\"&borrar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "=borrar\";" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " }" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " })" & gb.CrLf strVista &= "" & "})" & gb.CrLf 'editar strVista &= "" & "/* = == == == == == == == == == == == == == == == == == == == == == ==" & gb.CrLf strVista &= "" & " EDITAR " & gb.CrLf strVista &= "" & " == == == == == == == == == == == == == == == == == == == == == == = */" & gb.CrLf strVista &= "" & "$(\".tablas\").on(\"click\", \".btnEditar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", function() {" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " var id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & " = $(this).attr(\"id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\");" & gb.CrLf strVista &= "" & " console.log(id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & ");" strVista &= "" & "" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " var datos = new FormData();" & gb.CrLf strVista &= "" & " datos.append(\"id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", id" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "); " & gb.CrLf strVista &= "" & " datos.append(\"buscar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\", \"buscar" & utilerias.strPrimeraMayuscula(FMain.txtTabla.Text) & "\");" & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " $.ajax( {" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " url:\"controladores/" & FMain.txtTabla.text & ".controlador.php\"," & gb.CrLf strVista &= "" & " method:\"POST\"," & gb.CrLf strVista &= "" & " data: datos," & gb.CrLf strVista &= "" & " cache: false," & gb.CrLf strVista &= "" & " contentType: false," & gb.CrLf strVista &= "" & " processData: false," & gb.CrLf strVista &= "" & " dataType:\"json\"," & gb.CrLf strVista &= "" & " success: function(respuesta) {" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & strEditarTraeDatos & gb.CrLf strVista &= "" & " " & gb.CrLf strVista &= "" & " }" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & " });" & gb.CrLf strVista &= "" & "" & gb.CrLf strVista &= "" & "})" & gb.CrLf strVista &= "" & "</script>" & gb.CrLf Return strVista End
En la siguiente publicación veremos como generar los archivos modelos/vista/Controlador al darle click al botón Crear Catalogo
Comentarios
Publicar un comentario