Foros del Web » Programando para Internet » Javascript »

como asignar focus a un grid

Estas en el tema de como asignar focus a un grid en el foro de Javascript en Foros del Web. Mis cordiales saludos amigos foros del web Estoy realizando una pagina web con un grid, el cual se ha implementado con una libreria activewidgets en ...
  #1 (permalink)  
Antiguo 05/03/2011, 14:46
 
Fecha de Ingreso: marzo-2011
Mensajes: 6
Antigüedad: 13 años, 1 mes
Puntos: 0
Pregunta como asignar focus a un grid

Mis cordiales saludos amigos foros del web
Estoy realizando una pagina web con un grid, el cual se ha implementado con una
libreria activewidgets en su version free (1.0).
Necesito que al terminar de ingresar los datos en la caja de texto que le precede al grid, automaticamente se le asigne el focus al grid, es decir poder desplazarme por las files del grid de manera inmediata, que hasta el momento solo lo puedo realizar pulsando un click dentro del grid, pero por razones de funcionalidad se exige que sea automaticamente

El codigo el siguiente:

<script>

function asignarfocusalgrid(){
// como asignarlo?

}

</script>
<HTML>
<HEAD>
<TITLE>Insertar.html</TITLE>
</HEAD>

<BODY>
<h1>Insertar un registro</h1>
<br>
<FORM NAME="frminsertar" ID="frminsertar" METHOD="POST" ACTION="">

Nombre :
<input type="text" name="nombre" onkeyPress="
if (event.keyCode=='13'){
frminsertar.apellidos.focus()
}

"><br>
<script>
document.frminsertar.nombre.focus()
</script>

Apellidos:
<input type="text" name="apellidos" onkeyPress="
if (event.keyCode=='13'){
asignarfocusalgrid();
}

">
<br>

<br>
<br>
<br>
<table width="500" height="150" border="1">
<tr>
<td>
<?php
include('grdgrid.php');
?>
</td>
</tr>
</table>
<br>

<input type="button" name=" salir " id="salir" value=" salir" >

</FORM>

</BODY>
</HTML>

----------- Grid.php -------

<html>
<head>
<title>ActiveWidgets Grid :: Examples</title>
<style> body, html {margin:0px; padding: 0px; overflow: hidden;} </style>

<!-- ActiveWidgets stylesheet and scripts -->
<link href="./runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
<script src="./runtime/lib/grid.js"></script>

<!-- grid format -->
<style>
.active-controls-grid {height: 100%; font: menu;}

.active-column-0 {width: 80px;}
.active-column-1 {width: 200px;}
.active-column-2 {text-align: right;}
.active-column-3 {text-align: right;}
.active-column-4 {text-align: right;}

.active-grid-column {border-right: 1px solid threedlightshadow;}
.active-grid-row {border-bottom: 1px solid threedlightshadow;}
</style>

<!-- grid data -->
<script>
var myData = [
["MSFT","Microsoft Corporation", "314,571.156", "32,187.000", "55000"],
["ORCL", "Oracle Corporation", "62,615.266", "9,519.000", "40650"],
["SAP", "SAP AG (ADR)", "40,986.328", "8,296.420", "28961"],
["CA", "Computer Associates Inter", "15,606.335", "3,164.000", "16000"],
["ERTS", "Electronic Arts Inc.", "14,490.895", "2,503.727", "4000"],
["SFTBF", "Softbank Corp. (ADR)", "14,485.840", ".000", "6865"],
["VRTS", "Veritas Software Corp.", "14,444.272", "1,578.658", "5647"],
["SYMC", "Symantec Corporation", "9,932.483", "1,482.029", "4300"],
["INFY", "Infosys Technologies Ltd.", "9,763.851", "830.748", "15400"],
["INTU", "Intuit Inc.", "9,702.477", "1,650.743", "6700"],
["ADBE", "Adobe Systems Incorporate", "9,533.050", "1,230.817", "3341"],
["PSFT", "PeopleSoft, Inc.", "8,246.467", "1,941.167", "8180"],

];

var myColumns = [
"Ticker", "Company Name", "Market Cap.", "$ Sales", "Employees"
];
</script>
</head>
<body>
<script>

// create ActiveWidgets Grid javascript object
var obj = new Active.Controls.Grid;

// set number of rows/columns
obj.setRowProperty("count", 12);
obj.setColumnProperty("count", 5);

// provide cells and headers text
obj.setDataProperty("text", function(i, j){return myData[i][j]});
obj.setColumnProperty("text", function(i){return myColumns[i]});

// set headers width/height
obj.setRowHeaderWidth("28px");
obj.setColumnHeaderHeight("20px");

// set click action handler
obj.setAction("click", function(src){window.status = src.getItemProperty("text")});

// write grid html to the page
document.write(obj);

</script>
</body>
</html>

Etiquetas: focus, grid
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:44.