1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    1
    Vote Rating
    0
    pradeep29121 is on a distinguished road

      0  

    Default Unanswered: container control as a grid editor does not update values

    Unanswered: container control as a grid editor does not update values


    So I have a grid with two columns, the first has just text, the second
    needs to have a custom control (with a checkbox and a combo box)


    When I click update to update the row. The first column gets updated,
    but the second column doesn't

    This is how it looks:

    grid.PNG

    I naively added a getValue() into my custom control but no luck!! (Note: I'm using row editing plugin)


    Here is my code,

    Code:
        Ext.define('MainGrid', {
            extend: 'Ext.grid.Panel',
            //defs for all the toolbars and buttons
            plugins: [rowEditing],
            columns: [
                        {
                            xtype: 'rownumberer'
                        },
                        {
                            xtype: 'gridcolumn',
                            text: 'Column Titles',
                            dataIndex: 'ColumnTitle',
                            editor: {
                                xtype: 'textfield',
                            }
                        },
                        {
                            xtype: 'gridcolumn',
                            sortable: false,
                            align: 'center',
                            dataIndex: 'IssueCondition',
                            editor: {
                                xtype: 'reportpopulation'
                            }]
        });
    The reportpopulation is the custom control here. Here is the code for
    it:

    Code:
        Ext.define('SelectPopulation', {
            extend: 'Ext.container.Container',
            itemId: 'ctrSelectpopulation',
            alias: 'widget.reportpopulation',
            layout: {
                type: 'hbox'
            },
            initComponent: function () {
              //code to add combo box and checkbox snipped
              ....
            },
            getValue: function () {
                //This doesn't work! 
                return "Booo";
            }
        });
    So clicking Update doesn't :

    1.. Is there something I'm missing?
    2.. Should I inherit from FieldBase?

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,801
    Answers
    3467
    Vote Rating
    834
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    To make something a form you need to do different things. Here is an example:

    Code:
    Ext.define('MyField', {
        extend : 'Ext.container.Container',
        xtype  : 'myfield',
    
        isFormField : true,
        name        : null,
        value       : null,
    
        constructor : function(config) {
            config = config || {};
    
            if (config.value) {
                this.html = config.value;
            } else if (this.value) {
                this.html = this.value;
            }
    
            this.callParent([config]);
        },
    
        setValue : function (value) {
            this.value = this.html = value;
        },
    
        getValue : function() {
            return this.value;
        },
    
        getName : function() {
            return this.name;
        },
    
        getSubmitData : function() {
            var data = {};
    
            data[this.getName()] = this.getValue();
    
            return data;
        },
    
        isValid : function() {
            return true;
        },
    
        validate : function() {
            return this.isValid();
        },
    
        isFileUpload : function() {
            return false;
        }
    });
    
    new Ext.form.Panel({
        renderTo : document.body,
        url      : 'data/form.php',
        items    : [
            {
                xtype      : 'textfield',
                fieldLabel : 'Text',
                name       : 'text',
                value      : 'foo'
            },
            {
                xtype : 'myfield',
                name  : 'test',
                value : 'bar'
            },
            {
                xtype   : 'button',
                text    : 'Get Values',
                handler : function (btn) {
                    var form = btn.up('form');
    
                    console.log(
                        form.getValues()
                    );
                }
            },
            {
                xtype   : 'button',
                text    : 'Submit',
                handler : function (btn) {
                    var form = btn.up('form');
    
                    form.submit();
                }
            }
        ]
    });
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread

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