Pregunta

Tengo una lista desplegable que obtiene sus datos de una respuesta method.This de servicios web php se smthing como:

  

array ( 'id' => número entero, 'nombre' => 'lin')

Cuando se carga la página, que quieren establecer el índice seleccionado a "lin" inicialmente. ¿Cómo puedo hacer esto?

¿Fue útil?

Solución

sólo tiene que selectedIndex conjunto de propiedades del control DropDownList.

ej.

dwl.selectedIndex = 1; // "Index of "lin"

que debe hacer esto.

var iIndex:int;

for(var i:int = 0; i < arrResponse.length; i++)
{

       // if(Array(arrResponse[i])[1] == "lin")

       if(Array(arrResponse[i]).name == "lin") {
            iIndex = i;

       }

}

dwl.selectedIndex = iIndex;
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top