[Ror-es] Indicador "Loading" ajax

Luis Villegas luis.vilec at gmail.com
Mon Sep 3 06:22:38 GMT 2007


Yo lo tengo hecho de forma genérica así:

En application.js:
    Ajax.Responders.register({
        onCreate:showLoader,
        onComplete:hideLoader
    });


    function showLoader(){
        $('capa_cargando').style.visibility="visible"
    }

    function hideLoader(){
        $('capa_cargando').style.visibility='hidden';
    }

En el layout común:

<div id="capa_cargando"><%=image_tag 'spinner.gif'%> CARGANDO...</div>

Y el estilo para esto:

#capa_cargando {
    position: absolute;
    top: 2px;
    right: 15px;
    background-color: #FAD163;
    color: black;
    font-weight: bold;
    font-size: 9px;
    padding: 3px;
    visibility: hidden;
    text-align: right;
}





On 9/1/07, Carlos Ramos <ruby-forum-incoming at andreas-s.net> wrote:
>
> Miguel Angel Calleja Lázaro wrote:
> > Hola, En una llamada ajax c�mo puedo hacer para mostrar un loading en el
> > tiempo que llama a la funci�n y retorna los datos?
> > <%= link_to_remote( cli.nombre, :update => "listado_categorias", :url
> > =>{ :action => :getCategorias,:id=>cli.id}) %>
> >
> > Gracias
>
> Hola Miguel, solamente debes de añadir esto:
>
> :loading=>"Element.show('progreso')"
>
> Pero antes debes de crearte una imagen con un id "unico" y ocultarlo por
> ejemplo:
>
> <%= image_tag "spinner.gif", :id => "progreso", :style =>
> 'display:none;'%>
> --
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Ror-es mailing list
> Ror-es at lists.simplelogica.net
> http://lists.simplelogica.net/mailman/listinfo/ror-es
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.simplelogica.net/pipermail/ror-es/attachments/20070903/4247052a/attachment.htm 


More information about the Ror-es mailing list