Hybrid View

  1. #1
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default [2.x] Ext.grid.RadioColumn

    [2.x] Ext.grid.RadioColumn


    In the Help forum there were several requests for a 'survey' grid.


    (I modified the code to use radiobutton images instead; see post below)

    This can be easily done by modifying Ext.grid.CheckColumn:

    RadioColumn.js:
    Code:
    Ext.grid.RadioColumn = function(config){
        Ext.apply(this, config);
        if(!this.id){
            this.id = Ext.id();
        }
        this.renderer = this.renderer.createDelegate(this);
    };
    
    Ext.grid.RadioColumn.prototype ={
        init : function(grid){
            this.grid = grid;
            this.grid.on('render', function(){
                var view = this.grid.getView();
                view.mainBody.on('mousedown', this.onMouseDown, this);
            }, this);
        },
    
        onMouseDown : function(e, t){
            if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
                e.stopEvent();
                var index = this.grid.getView().findRowIndex(t);
                var record = this.grid.store.getAt(index);
                record.set(this.dataIndex, this.inputValue);
            }
        },
    
        renderer : function(v, p, record){
            p.css += ' x-grid3-check-col-td'; 
            return '<div class="x-grid3-check-col'+(v == this.inputValue?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
        }
    };
    Usage:
    Code:
    Ext.onReady(function(){
    	var store = new Ext.data.SimpleStore({
    		fields: ['question', 'answer'],
    		data: [['Staff', 3], ['Services', 3], ['Clean', 3], ['Comfort', 3], ['Value for money', 3]]
    	});
    	var answers = [
    		new Ext.grid.RadioColumn({header: 'Very poor', inputValue: 1, dataIndex: 'answer', width: 75, align: 'center', sortable: true}),
    		new Ext.grid.RadioColumn({header: 'Poor', inputValue: 2, dataIndex: 'answer', width: 75, align: 'center', sortable: true}),
    		new Ext.grid.RadioColumn({header: 'Average', inputValue: 3, dataIndex: 'answer', width: 75, align: 'center', sortable: true}),
    		new Ext.grid.RadioColumn({header: 'Good', inputValue: 4, dataIndex: 'answer', width: 75, align: 'center', sortable: true}),
    		new Ext.grid.RadioColumn({header: 'Very good', inputValue: 5, dataIndex: 'answer', width: 75, align: 'center', sortable: true})
    	];
    	var columns = [
    		{header: 'Review your stay', dataIndex: 'question', width: 100, sortable: true}
    	].concat(answers);	
    	var grid = new Ext.grid.EditorGridPanel({
    		store: store,
    		plugins: answers,
    		columns: columns,
    		width: 475,
    		autoHeight: true,
    		renderTo: document.body
    	});
    });

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,123
    Vote Rating
    512
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    That's cool, very useful!

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    11
    Vote Rating
    0
    nb is on a distinguished road

      0  

    Default problem

    problem


    can't select multiple checkbox in one row???

  4. #4
    Sencha - Community Support Team mystix's Avatar
    Join Date
    Mar 2007
    Location
    Singapore
    Posts
    6,236
    Vote Rating
    4
    mystix will become famous soon enough

      0  

    Default


    Quote Originally Posted by nb View Post
    can't select multiple checkbox in one row???
    it's a RadioColumn.

    you can't score both "Very Poor" and "Very Good" for cleanliness.

  5. #5
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    Perhaps it is confusing that I still used the original checkbox images.

    I included a new version using radio images.
    Attached Files

  6. #6
    Ext User Ritesh's Avatar
    Join Date
    Nov 2007
    Location
    South Africa
    Posts
    10
    Vote Rating
    0
    Ritesh is on a distinguished road

      0  

    Default well done Condor, this is awesome

    well done Condor, this is awesome


    Thanx Condor, this is more or less what i needed.

    Does anyone know if it is possible to do this in the headings? see screenshot
    even if you could point me to the right direction
    Attached Images
    Last edited by Ritesh; 31 Jul 2008 at 6:05 AM. Reason: updated text

  7. #7
    Sencha User
    Join Date
    Oct 2010
    Posts
    49
    Vote Rating
    0
    Komal Vaswani is on a distinguished road

      0  

    Default


    Hi,
    I want to store the value of radio button which I have selected back into the Database..so can u give me the idea how can I retrieve the inputvalue of selected radio button?

    Thanks,
    Komal

  8. #8
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    RadioColumn stores the inputValue of the selected radio in the field of the record in the store.

    This means you only have to send the store content and don't have to bother about radio states.

  9. #9
    Sencha User
    Join Date
    Oct 2010
    Posts
    49
    Vote Rating
    0
    Komal Vaswani is on a distinguished road

      0  

    Default


    Hi,
    How can I send the store content to java action class? any example?

  10. #10
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    This is array data, not simple name/value pairs, so I first have to know what kind of parameter format your server is expecting.

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar