PHP - Header de una tabla estaticos

 
Vista:

Header de una tabla estaticos

Publicado por Pablo Pinedo (5 intervenciones) el 04/12/2015 00:11:49
Saludos Amigos Programadores

Necesito saber como poder poner fija la fila donde estan los nombres de los campos de una tabla de consulta

+--------------+------------------------+--------------------------+
|codigo | Nombre | Apellido | --------> Fila Fija
*--------------+------------------------+---------------------------+
|001 | Juan | Perez |
+-------------+-------------------------+--------------------------+
|002 | Carlos | Rodriguez |
+-------------+------------------------+---------------------------+

he intentado varios ejemplos pero ninguno me funciona por favor agradecere me puedan dar la mano.

copio aqui mi codigo. y les agradesco desde ya su apoyo.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
session_start();
error_reporting(E_ALL ^ E_NOTICE);
 
include "kint/Kint.class.php";
 
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
 
$cod = "";
if (isset($_GET['cod'])) {
    $cod = $_GET['cod'];
}
$desc = "";
if (isset($_GET['desc'])) {
    $desc = $_GET['desc'];
}
$cate = "";
if (isset($_GET['cate'])) {
	$fam = $_GET['cate'];
}
 
?>
<html>
    <head>
        <title>..::IAM : CIE-10::..</title>
        <link rel="stylesheet" media="screen" href="css/normalize.css" />
        <link rel="stylesheet" media="screen" href="test.css" />
        <link rel="stylesheet" type="text/css" href="css/autocomplete.css" />
		<link rel="stylesheet" type="text/css" href="css/estatico.css" />
		<link rel="stylesheet" type="text/css" media="screen" href="jqgrid/css/ui.jqgrid.css" />
        <!-- Archivos javascript -->
        <script src="jqgrid/js/jquery.min.js" type="text/javascript"></script>
        <script src="jqgrid/js/jquery-ui.min.js" type="text/javascript"></script>
        <script type="text/javascript">
			var tableOffset = $("#table-1").offset().top;
			var $header = $("#table-1 > thead").clone();
			var $fixedHeader = $("#header-fixed").append($header);
 
			$(window).bind("scroll", function() {
				var offset = $(this).scrollTop();
 
				if (offset >= tableOffset && $fixedHeader.is(":hidden")) {
					$fixedHeader.show();
				}
				else if (offset < tableOffset) {
					$fixedHeader.hide();
				}
			});
 
 
            $().ready(function () {
                $('#txtDesc').autocomplete('cieDescAuto.php', {
                    width: 500,
                    matchContains: true,
                    selectFirst: false
                });
 
                $('#txtCod').autocomplete('cieCodAuto.php', {
                    width: 620,
                    matchContains: true,
                    selectFirst: false
                });
 
                $('#txtCat').autocomplete('cieCatAuto.php', {
                    width: 620,
                    matchContains: true,
                    selectFirst: false
                });
 
            });
        </script>
        <script type="text/javascript">
            function expRegularNum(e)
            {
                var tecla;
                tecla = (document.all) ? e.keyCode : e.which;
                if (tecla == 8)
                {
                    return true;
                }
                if (tecla == 13)
                {
                    document.getElementById('btnsub').click();
                    return false;
                }
 
                var patron;
                patron = /[0-9]/
                var te;
                te = String.fromCharCode(tecla);
                return patron.test(te);
            }
 
            function expRegularCar(e)
            {
                var tecla;
                tecla = (document.all) ? e.keyCode : e.which;
                if (tecla == 8)
                {
                    return true;
                }
                var patron;
                patron = /[A-Za-z��\s]/
                var te;
                te = String.fromCharCode(tecla);
                return patron.test(te);
            }
 
            function limpiar(x) {
                document.getElementById('txtCod').value = "";
                document.getElementById('txtDesc').value = "";
				document.getElementById('txtCat').value = "";
                frmSegus.submit();
            }
        </script>
 
    </head>
    <body>
        <div id='header'>
            <div class='left'align="left">
                <h1>CIE-10</h1>
                <h2>Informaci&oacute;n de Apoyo para M&eacute;dicos</h2>
            </div>
            <div class='right' align="right">
                <img id='logo' src='img/logo clinica internacional.gif' alt='Logo Clinica Internacional'/>
            </div>
        </div>
 
        <div id="menu" style="margin-top:75px;">
                <table width="100%">
                    <tr>
                        <td width='10%'><a href='index.php'><img src='img/segus.png' >Segus</a></td>
                        <td width='10%'><a href='indexCie10.php'><img src='img/cie10.png'>CIE-10</a></td>
                        <td width='10%'><a href='indexPetitorio.php'><img src='img/petitorio.png'>Petitorio</a></td>
                        <td width='10%'><a href='indexLasa.php'><img src='img/lasa.png'>LASA</a></td>
                        <td width='10%'><a href='indexaltoriesgo.php'><img src='img/altoriesgo.png'>Alto Riesgo</a></td>
                    </tr>
                </table>
        </div>
 
        <div style="width:90%; margin:0 auto;" align="center">
            <form id='frmSegus' name='frmSegus' method='post' action='xCie10.php'>
                <input type='text' id='txtCod' name='txtCod' value='<?php echo $cod; ?>' placeholder='c&oacute;digo' onkeypress='javascript:return expRegularNum(event);'/>
                <input type='text' id='txtDesc' name='txtDesc' value='<?php echo $desc; ?>' placeholder='descripci&oacute;n'/>
                <input type='text' id='txtCat' name='txtCat' value='<?php echo $cate; ?>' placeholder='categor&iacute;a'/>
                <input type='submit' id='btnSub' name='btnSub' value=''/>
                <a href="javascript:limpiar();" style="color:#403D3D;">Limpiar</a>
            </form>
        </div>
 
		<?php
 
		require("conexion.php");
 
		$vQuery01= "select codigo, diagnostico, categoria from cie10 where codigo is not null ";
 
		if ($_SESSION['desc'] != ""){
			$vQuery01 .= "and upper(diagnostico) like upper('%".$_SESSION['desc']."%') ";
		};
		if ($_SESSION['cod'] != ""){
			$vQuery01 .= "and codigo like upper('%".$_SESSION['cod']."%') ";
		};
		if ($_SESSION['cate'] != ""){
			$vQuery01 .= "and upper(categoria) like upper('%".$_SESSION['cate']."%') ";
		};
		$stid = oci_parse($conn,$vQuery01);
		oci_execute($stid);
 
 
		?>
 
		<div  id="Contenido-Segus">
			<table width='90%' border='1px' align='right'>
					<tr>
						<thead>
							<th>Codigo</th>
							<th>Diagnostico</th>
							<th>Categoria</th>
						</thead>
						<tbody>
						<?php
							while (($linea=oci_fetch_array($stid, OCI_ASSOC))!=false){
							/*	print_r($linea); */
								echo '<tr>
									  <td>'.$linea["CODIGO"].'</td>
									  <td>'.$linea["DIAGNOSTICO"].'</td>
									  <td>'.$linea["CATEGORIA"].'</td>
									 </tr>';
							};
						?>
					</tr>
			</table>
		</div>
        <div id="firma" style="top-margin:140px; font-size:8px;">Elaborado por:</div>
        <div id="firma" style="font-size:8px;">Gerencia de Sistemas</div>
        <div id="firma" style="font-size:8px;">Mayo - Diciembre 2015</div>
    </body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Header de una tabla estaticos

Publicado por xve (6935 intervenciones) el 04/12/2015 09:01:16
Hola Pablo, cuando dices fija, entiendo que te refieres a que siempre tenga la misma anchura, verdad?

No nos muestras los archivos css, que es ahí donde deberías especificar la anchura, pero si veo que la tabla la defines con una anchura del 90%, por lo que siempre variara dependiendo de la anchura de su contenedor...

Has probado a ponerle un valor fijo?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Header de una tabla estaticos

Publicado por Pablo Pinedo (5 intervenciones) el 04/12/2015 16:55:43
Hola. No exactamente a la anchura... lo que quiero es que al momento que baje la informacion de la tabla las cabeceras no se muevan es decir no se vayan arriba de la pantalla.

Copio aqui el Css test que es el Css que maneja los estilos personalizados del sistema.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
@import url(https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300);
* {
	color: #444;
/*	font-family: 'McLaren', cursive; */
	font-weight: bold;
	font-size: 14px;
        position: relative;
}
 
.main {
	text-align: center;
	padding-bottom: 1.5%;
	width: 100%;
}
 
#header{
	position: relative;
	padding:  20;
        width:800px;
        margin:0 auto;
}
 
#header .left{
	position: absolute;
	left: 20px;
	top: 13px;
}
 
#header .right{
	position: absolute;
        text-align: right;
	left: 150px;
	top: 15px;
}
 
#header-fixed {
    position: fixed;
    top: 0px; display:none;
    background-color:white;
}
 
#menu{
    top: 20;
	position: relative;
	padding:  10;
        width:800px;
        margin:20 auto;
}
 
#logo {
	max-width: 40%;
	height: auto;
	width: 40%;
        top: 10px;
        left: 100px;
}
 
img {
	max-width: 20%;
	height: auto;
	width: 20%;
}
 
h1 {
	color: #013781;
	font-size: 2.5em;
	margin: 0;
	padding: 0;
}
 
h2 {
	color: #00A9DF;
	font-size: 1em;
	margin: 0;
	padding: 0;
}
 
.menu li a {
font-family: arial;
font-size:20px;
text-decoration: none;
float:left;
padding: 10px;
background-color: #fff;
color: #013781;
width: 90%;
/*vertical-align: middle;*/
list-style-image:none; list-style-position:outside; list-style-type:none; display:inline;
}
 
 
.menu li a:hover {
background-color: #00A9DF;
margin-top:-2px;
padding-bottom:12px;
list-style-image:none; list-style-position:outside; list-style-type:none; display:inline;
}
 
#txtdesc {
	width: 20em;
}
 
input {
	height:1.75em;;
	background:#eee;
	border-radius:5px;
	border:1px solid #262525;
	font-weight: normal;
	padding:10px;
	color:#3a3a3a;
}
 
input:focus, textarea:focus {
	border:1px solid #97d6eb;
}
 
ul,
ul ul {
    margin: 0;
    padding: 0px;
    list-style: none;
    text-align: left;
    position: relative;
}
 
 
ul, li
{
list-style-image:none; list-style-position:outside; list-style-type:none; display:inline;
}
 
a {
	text-decoration: none;
}
 
#firma2 {
	color:#000; 
	text-align:center;
	font-size: 1em;
	margin-top: 25px;
	margin-bottom: 25px;
}
 
.firma2 {
	font-weight: bold;
}
 
#firma {
	color:#00A9DF; 
	text-align:center;
	font-size: 1em;
}
 
.firma2 {
	font-weight: normal;
}
 
#firma3 {
	color:#000; 
	text-align:center;
	font-size: 1em;
	margin-top: 15px;
	margin-bottom: 15px;
}
 
#txtcod {
	width: 5.25em;
}
 
#txtdesc {
	width: 20em;
}
 
#btnsub {
	height:1.8em;
	background:url(img/btnsub.png) no-repeat;
	width:1.8em;
	text-indent:-9999px;
	border:none;
	cursor:pointer;
}
 
#btnsub:hover {
	opacity:0.9;
}
 
.menu li a {
font-family: arial;
font-size:20px;
text-decoration: none;
float:left;
padding: 10px;
background-color: #fff;
color: #013781;
width: 90%;
/*vertical-align: middle;*/
list-style-image:none; list-style-position:outside; list-style-type:none; display:inline;
}
 
 
.menu li a:hover {
background-color: #00A9DF;
margin-top:-2px;
padding-bottom:12px;
list-style-image:none; list-style-position:outside; list-style-type:none; display:inline;
}
 
#contenido-segus {
	font-family: 'Open Sans Condensed', sans-serif;
	font-size:10px;
	height:500px;
	width:90%;
	overflow-y:scroll;
	margin-bottom:25px;
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar