1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    56
    Vote Rating
    0
    mpatel is on a distinguished road

      0  

    Question [SOLVED] Color Picker

    [SOLVED] Color Picker


    Hello guys,

    In the following code, I would like to have a color picker instead of the text box... how do i go about this?

    PHP Code:
    Ext.onReady(function(){

        
    Ext.BLANK_IMAGE_URL 'ext/resources/images/default/s.gif';
        
    Ext.QuickTips.init();

        
    Ext.form.Field.prototype.msgTarget 'side';
        
        var 
    parentList = new Ext.data.Store({    
            
    proxy: new Ext.data.HttpProxy({url'/categories/getCategories'}),
            
    reader: new Ext.data.JsonReader({
            
    root'categories',
            
    fields: [
                {
    name'id'},
                {
    name'name'}
            ]
            })
        });
        
        
    parentList.load();
        
        var 
    form_edit = new Ext.FormPanel({
            
    url:'/categories/edit/',
            
    frame:true,
            
    title'Edit Category',
            
    bodyStyle:'padding:5px 5px 0',
            
    width350,
            
    defaults: {width230},
            
    defaultType'textfield',

            
    items: [{
                    
    fieldLabel'Name',
                    
    name'data[Category][name]',
                    
    valueval_name,
                    
    allowBlank:false
                
    },{
                    
    fieldLabel'Color',
                    
    name'data[Category][color]',
                    
    valueval_color,
                    
    disabledtrue
                
    }, new Ext.form.ComboBox({
                    
    fieldLabel'Parent',
                    
    name'data[Category][parent_id]',
                    
    storeparentList,
                    
    displayField'name',
                    
    valueField'id',
                    
    mode'local',
                    
    forceSelectiontrue,
                    
    editablefalse,
                    
    mode'remote',
                    
    valueval_parent
                
    })
            ],

            
    buttons: [{
                
    text'Save'
            
    },{
                
    text'Cancel'
            
    }]
        });
        
        
    form_edit.render('content');
    }) 
    Thanks
    Last edited by mpatel; 17 Jan 2008 at 2:44 PM. Reason: Solved!

  2. #2
    Ext User para's Avatar
    Join Date
    Apr 2007
    Location
    Redmond, WA
    Posts
    918
    Vote Rating
    -2
    para has a little shameless behaviour in the past

      0  

    Default


    Try something like:
    Code:
                },{
                    fieldLabel: 'Color',
                    name: 'data[Category][color]',
                    value: val_color,
                    disabled: true,
                    xtype: 'colorpalette'
    I'm not sure though.

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    56
    Vote Rating
    0
    mpatel is on a distinguished road

      0  

    Question


    Excellent!!

    But how can I get more colors??
    I've changed the code a bit though:

    PHP Code:
    Ext.onReady(function(){

        
    Ext.BLANK_IMAGE_URL 'ext/resources/images/default/s.gif';
        
    Ext.QuickTips.init();

        
    Ext.form.Field.prototype.msgTarget 'side';
        
        var 
    parentList = new Ext.data.Store({    
            
    proxy: new Ext.data.HttpProxy({url'/categories/getCategories'}),
            
    reader: new Ext.data.JsonReader({
            
    root'categories',
            
    fields: [
                {
    name'id'},
                {
    name'name'}
            ]
            })
        });
        
        
    parentList.load();
        
        var 
    form_edit = new Ext.FormPanel({
            
    url:'/categories/edit/',
            
    frame:true,
            
    title'Edit Category',
            
    bodyStyle:'padding:5px 5px 0',
            
    width350,

            
    items: [{
                
    xtype:'fieldset',
                
    title'General Information',
                
    autoHeight:true,
                
    defaults: {width210},
                
    defaultType'textfield',
                
    items :[{
                    
    fieldLabel'Name',
                    
    name'data[Category][name]',
                    
    valueval_name,
                    
    allowBlank:false
                
    },new Ext.form.ComboBox({
                    
    fieldLabel'Parent',
                    
    name'data[Category][parent_id]',
                    
    storeparentList,
                    
    displayField'name',
                    
    valueField'id',
                    
    mode'local',
                    
    forceSelectiontrue,
                    
    editablefalse,
                    
    mode'remote',
                    
    valueval_parent
                
    })
                ]
            },{
                
    xtype:'fieldset',
                
    title'Category Color',
                
    collapsibletrue,
                
    autoHeight:true,
                
    defaults: {width210},
                
    defaultType'textfield',
                
    items :[{
                    
    fieldLabel'Color',
                    
    name'data[Category][color]',
                    
    valueval_color,
                    
    xtype'colorpalette'
                
    }
                ]
            }],

            
    buttons: [{
                
    text'Save'
            
    },{
                
    text'Cancel'
            
    }]
        });
        
        
    form_edit.render('content');
    }) 

    Quote Originally Posted by para View Post
    Try something like:
    Code:
                },{
                    fieldLabel: 'Color',
                    name: 'data[Category][color]',
                    value: val_color,
                    disabled: true,
                    xtype: 'colorpalette'
    I'm not sure though.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi