1. #1
    Ext User
    Join Date
    Mar 2008
    Posts
    9
    Vote Rating
    0
    Javiera is on a distinguished road

      0  

    Default Custom Boolean Toggle for Editor Grid

    Custom Boolean Toggle for Editor Grid


    Anyone interested in an iphone-style toggle? Perhaps for editor /property grids? I think it would be a neat alternative to a check or combo box. Thoughts?

    PHP Code:
    <html><head>
            <
    script type="text/javascript">
                
    Ext.onReady(function(){
                    var 
    toggle 'off';
                    var 
    tpl = {
                        
    on: new Ext.Template('<img src="btn_on.jpg">'),
                        
    off: new Ext.Template('<img src="btn_off.jpg">')
                    };
                    
    Ext.get("btn").on('click', function() {
                        
    tpl[toggle].overwrite('btn');
                        
    toggle = (toggle == 'on') ? 'off' 'on';
                    });
                });
            
    </script>
    </head>
    <body>
            <a id="btn"><img src="btn_off.jpg"></a>
    </body>
    </html> 
    Attached Images

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    94
    Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of Condor has much to be proud of

      0  

    Default


    You could modify the CSS for Ext.grid.CheckColumn and Ext.ux.form.Combobox to use these images.

    ps. The images are a bit large. They won't fit nicely into the Ext JS theme.

Thread Participants: 1