1. #11
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    124
    Answers
    1
    Vote Rating
    0
    JavascriptParrot is on a distinguished road

      0  

    Default


    I don't like to use server side calculation at this point because it is a concept and it should not take too much time. But I think you right, it's better to use the server side in this case.

    Edit: I don't know if server side is better, one second sending, one second receiving and then updating store and painting grids?

    The calculations are very simple, I find it strange that it take so much time.

    Thanks
    Last edited by JavascriptParrot; 6 Sep 2012 at 7:03 AM. Reason: I'm not sure what is better

  2. #12
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    124
    Answers
    1
    Vote Rating
    0
    JavascriptParrot is on a distinguished road

      0  

    Question


    Hello,

    Does it make sense when I use two stores? Now I have a grid, showing 4 columns from the store. After updating one field in the grid, the field is updated in the store. Then I update the calculating fields, the store is changed so the grid is refreshed (i think) but the calculated fields are not include in the grid. And when reloads the store/grid? After set all the calculated fields or after each calculated/changed field. In the last case it's better to use a store without a grid for the calculations.

    Thanks!

  3. #13
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    updateCalculatedFields: function(){
    this.set('Total'); this.set('StraightElementNNO3'); this.set('StraightElementNNH4');
    this.set('StraightElementNNH2'); this.set('StraightElementNtotal'); this.set('StraightElementP205');
    this.set('StraightElementK2O'); this.set('StraightElementMgO'); this.set('StraightElementSO3');
    this.set('StraightElementCl'); this.set('TraceElementFePPM'); this.set('TraceElementFePercentage');
    this.set('TraceElementMnPPM'); this.set('TraceElementMnPercentage'); this.set('TraceElementZnPPM');
    this.set('TraceElementZnPercentage');this.set('TraceElementCuPPM');
    this.set('TraceElementCuPercentage');this.set('TraceElementBPPM');
    this.set('TraceElementBPercentage');this.set('TraceElementMoPPM');
    this.set('TraceElementMoPercentage');
    }
    Also, instead of setting value for each field, you should setting multiple fields.
    Code:
    updateCalculatedFields: function(){
        this.set({
            Total: null,
            StraightElementNNO3: null,
            StraightElementNNH4: null,
            ...
        });
    }

  4. #14
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    124
    Answers
    1
    Vote Rating
    0
    JavascriptParrot is on a distinguished road

      0  

    Default


    Thanks! This improves speed considerably!
    Is it possible to use store.sum for more than one field? I have a lot of sums, for each sum it loop trough the records. It would be faster when the loop is run once and return the sums in an object.

    Thanks

  5. #15
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    <store>.sum() only calculate sum for one field at a time, so you should write your own sum() to do sum for all fields you want.

  6. #16
    Touch Premium Member
    Join Date
    Nov 2011
    Posts
    124
    Answers
    1
    Vote Rating
    0
    JavascriptParrot is on a distinguished road

      0  

    Default


    I did but it doesn't make sense, for now I'm happy...
    Now it's time for weekend.

    Thanks

  7. #17
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    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


    Please see the following:


  8. #18
    Sencha User
    Join Date
    Jan 2014
    Location
    pittsburg , PA
    Posts
    32
    Vote Rating
    0
    arunmatics is on a distinguished road

      0  

    Default Urgent Help

    Urgent Help


    Hi Please reply me ASAP.


    Quote Originally Posted by arunmatics View Post
    Thanks for your valuable reply. I attached screen sot here which one I need to wrte the code.
    The user has entered the value in quantity column.

  9. #19
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    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


    Here is a quick change to make the grid editable and then it will calc the summary:

    Just use the store same store then update the grid as follows:

    Code:
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit : 1
        });
        
        var editText = { xtype : 'textfield' };
        var editNumb = { xtype : 'numberfield' };
        
        Ext.create('Ext.grid.Panel', {
            title    : 'Simpsons',
            store    : Ext.data.StoreManager.lookup('simpsonsStore'),
            selModel : {
                selType: 'cellmodel'
            },
            columns  : [
                { header : 'Name', dataIndex : 'name', editor : editText },
                { header : 'Email', dataIndex : 'email', flex : 1, editor : editText },
                { header : 'Change', dataIndex : 'change', editor : editNumb, summaryType: 'sum' }
            ],
            height   : 200,
            width    : 400,
            renderTo : Ext.getBody(),
    
            features: [{
                ftype: 'summary'
            }],
            
            plugins : [ cellEditing ]
    
        });

  10. #20
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    8,927
    Answers
    656
    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


    Here is another starting point. I do believe I have ran into a summary bug to where it is not working correctly on calculated field (convert) as the summary for the total field is not updating.

    I will have to investigate a bit more.

    Code:
    // main app
    Ext.onReady(function () {
       
        var store = Ext.create('Ext.data.Store', {
            fields: [
                'student', 
                { name : 'quantity', type : 'int' },
                { name : 'month1',   type : 'int' },
                { name : 'month2',   type : 'int' },
                { 
                  name : 'total',    type : 'int',
                  convert: function(val, record) {
                      var qty = (record.data.quantity > 0) ? record.data.quantity : 1;
                      return (qty * (record.data.month1 + record.data.month2));
                   }
                }    
            ],
    
            data: { 'items' : [
                {
                    student  : 'Row 1',
                    quantity : 1,
                    month1   : 100,
                    month2   : 50
                },{
                    student  : 'Row 2',
                    quantity : 1,
                    month1   : 200,
                    month2   : 100
                },{
                    student  : 'Row 3',
                    quantity : 1,
                    month1   : 300,
                    month2   : 150
                }
            ]},
    
            proxy   : {
                type   : 'memory',
                reader : {
                    type : 'json',
                    root : 'items'
                }
            }
        });
    
        var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
            clicksToEdit : 1,
            listeners    : {
                edit : function(editor, e, eOpts){
                    e.record.set('total'); // make sure convert field is calculated :: EXTJSIV-5137
                }
            }
        });
        
        var editText = { 
            xtype : 'textfield' 
        };
    
        var editNumb = { 
            xtype    : 'numberfield', 
            minValue : 0 
        };
    
        var grid = Ext.create('Ext.grid.Panel', {
            width: 600,
            height: 140,
            renderTo: document.body,
    
            store: store,
    
            columns: [{
                dataIndex: 'student',
                text: 'Name',
                summaryType: 'count',
                summaryRenderer: function(value, summaryData, dataIndex) {
                    return Ext.String.format('{0} row{1}', value, value !== 1 ? 's' : ''); 
                }
            }, {
                dataIndex   : 'quantity',
                text        : 'Quantity',
                editor      : editNumb
            }, {
                dataIndex   : 'month1',
                text        : 'Month1',
                summaryType : 'sum'
            }, {
                dataIndex   : 'month2',
                text        : 'Month2',
                summaryType : 'sum'
            }, {
                dataIndex   : 'total',
                text        : 'total',
                summaryType : 'sum'
            }],
    
            features : [{
                ftype : 'summary'
            }],
            
            plugins  : [ cellEditing ],
    
        });
        
    });

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