1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    6
    Vote Rating
    0
    grumpus is on a distinguished road

      0  

    Default Unanswered: Define CellEditing numberfield step value for each row in a Grid

    Unanswered: Define CellEditing numberfield step value for each row in a Grid


    We're considering implementing ExtJS 4 in our next project, but our initial tests of the library have come up with some potential limitations of the CellEditing Grid plugin.

    One thing we would like to accomplish is to create a grid into which the user will be able to enter a long list of numbers. Ext.grid.plugin.CellEditing works well for this purpose, especially when combined with the numberfield form element. API documentation points out that config parameters for the editor should be set in the definition of the grid column, like so:

    Code:
    {
        header    : 'Numbers',
        dataIndex : 'number',
        field     : {
            xtype         : 'numberfield',
            allowDecimals : false,
            minValue      : 0,
            step          : 25,
            selectOnFocus : true
        }
    }
    Is there a way to define the "step" parameter dynamically, i.e. set it to a different value for each row, based on the value of another field in the record?

    Any help will be appreciated.

  2. #2
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,912
    Answers
    655
    Vote Rating
    443
    scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future scottmartin has a brilliant future

      0  

    Default


    There is not a function that I can see, but you can always create a simple override such as:

    Code:
    // simple override
    Ext.override(Ext.form.field.Number,{
        setStep: function(step) {
           var me = this;
           me.step = step;
        }    
    });    
                 
    // test override
    Ext.create('Ext.form.Panel', {
        title: 'On The Wall',
        width: 300,
        bodyPadding: 10,
        renderTo: Ext.getBody(),
        items: [{
            xtype: 'numberfield',
            id: 'stepfield', // using id for demo, ugh
            anchor: '100%',
            name: 'bottles',
            fieldLabel: 'Bottles of Beer',
            value: 10,
            maxValue: 99,
            minValue: 0
        }],
        buttons: [{
            text: 'Take one down, pass it around',
            handler: function() {
                this.up('form').down('[name=bottles]').spinDown();
            }
        },
        {
            text: 'Increase Step',
            handler: function() {
               var ned = Ext.getCmp('stepfield');
               ned.setStep(20); 
                
            }
        }
        ]
    });
    Regard,
    Scott.

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