The official release of Ext.NET Mobile is now available. Ext.NET Mobile is an ASP.NET component framework for building Phone and Tablet specific mobile web applications. Read More

GridPanel CheckboxSelectionModel - Add Selected

  1. #1

    GridPanel CheckboxSelectionModel - Add Selected

    How can I sum a particular column of all selected rows? (Via javascript)

                
        <script>
            var sumCheck= function () {
                var resultSum;
    
              /* todo loop selectedrows
                 resultSum += column(nvlparmvfin); */;
                
                alert(resultSum);
            };
        </script>
           
     <ext:GridPanel runat="server" ID="grid1" Height="250px" Frame="true" StoreID="dsGrid1">
                            <ColumnModel runat="server">
                                <Columns>
                                    <ext:NumberColumn runat="server" DataIndex="nvlparmvfin" Format=",0.00" Align="Right"/>                             
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:CheckboxSelectionModel runat="server" Mode="Multi">
                                    <Listeners>
                                        <SelectionChange Fn="sumCheck()" />
                                    </Listeners> 
                                </ext:CheckboxSelectionModel>
                            </SelectionModel>                       
    </ext:GridPanel>
    If you can help me, thank you very much;
  2. #2

    you can try this

    var resultSum= 0 ;
    Ext.getCmp('grid1').getSelectionModel().getSelection().forEach(function(d){
      resultSum+=d.data["here is the your column to be summed up "]
    })
    
    alert('the sum is  ' + resultSum)

Similar Threads

  1. Replies: 0
    Last Post: Dec 05, 2017, 6:12 PM
  2. Replies: 4
    Last Post: Jan 24, 2017, 1:16 PM
  3. Replies: 1
    Last Post: May 03, 2015, 5:31 PM
  4. Replies: 2
    Last Post: Sep 05, 2013, 5:51 PM
  5. Replies: 1
    Last Post: Mar 02, 2012, 10:36 AM

Posting Permissions