[CLOSED] V2.0 SummaryGroups error

  1. #1

    [CLOSED] V2.0 SummaryGroups error

    Hi, then change a several time the continent i retrive an error in the getPrintData function from ext dll, here the problem:

    Execute the current actions:

    1)Select IT from the grid, and it will appear in the form OK, the combo show "Europe"
    2)Select from the combo "Oceania" e click the button save, in the grid the summary change from "Europe" to "Oceania" it's work OK

    If you reselect "Europa" from the combo the summary work OK...

    3)Select "America" from combobox and click save, in the grid the summary "Europa" disappears and the "Italia" is in the summary "America"..work fine
    4)Reselect "Europa" from the combobox and click save...does not work now and appear the error:

    Errore di run-time di Microsoft JScript: Impossibile ottenere il valore della proprietà 'name': oggetto nullo o non definito

    in the code:
     getPrintData: function(index){
            var me = this,
                columns = me.view.headerCt.getColumnsForTpl(),
                i = 0,
                length = columns.length,
                data = [],
                name = me.summaryGroups[index - 1].name,
                active = me.summaryData[name],
                column;
    
            for (; i < length; ++i) {
                column = columns[i];
                column.gridSummaryValue = this.getColumnValue(column, active);
                data.push(column);
            }
            return data;
        },
    Where is my code...page aspx:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ARWebRevolution.WebForm1" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
     
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
          <ext:Store ID="Store1" runat="server" >
                <Model>
                    <ext:Model ID="Model1" runat="server" IDProperty="ConId">
                        <Fields>
                            <ext:ModelField Name="ConId" />
                            <ext:ModelField Name="ConCod" />
                            <ext:ModelField Name="ConDes" />                        
                        </Fields>
                    </ext:Model>
                </Model>            
            </ext:Store>
            <ext:Store ID="Store2" runat="server" GroupField="ConDes" >
                <Model>
                    <ext:Model ID="Model2" runat="server"  IDProperty="NazId">
                        <Fields>
                            <ext:ModelField Name="ConId" />
                            <ext:ModelField Name="ConDes" />
                            <ext:ModelField Name="NazId" />
                            <ext:ModelField Name="NazCod" />
                            <ext:ModelField Name="NazDes" />
                        </Fields>
                    </ext:Model>
                </Model>            
            </ext:Store>
             <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>
                <ext:Panel ID="PanelNazioni" runat="server" Region="West" Width="300" BodyPadding="3"
                    Layout="FitLayout" >
                    <Items>
                        <ext:GridPanel ID="GridPanelNazioni" runat="server" Title="Nazioni"
                            StoreID="Store2" >
                            <ColumnModel>
                                <Columns>
                                    <ext:Column runat="server" ID="NazCod" DataIndex="NazCod" Align="Left" Text="Codice" Width="100" />
                                    <ext:Column runat="server" ID="NazDes" DataIndex="NazDes" Align="Left" Width="100" Text="Nazione" />   
                                    <ext:Column runat="server" ID="ConDes" DataIndex="ConDes" Align="Left" Flex="1" Text="Continente" />        
                                         
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel ID="RowSelectionModelNazione" Mode="Single" runat="server">
                                    <Listeners>
                                        <Select Handler="enableButtonRowSelect(record);" />
                                    </Listeners>
                                </ext:RowSelectionModel>
                            </SelectionModel>
                            <View>
                    <ext:GridView ID="GridViewNazioni" runat="server" StripeRows="true" MarkDirty="false" />
                </View>
                <Features>               
                    <ext:GroupingSummary ID="GroupingSummaryContinenti" runat="server" GroupHeaderTpl='{name} ({[values.rows.length]} {[values.rows.length > 1 ? "Nazioni":"Nazione"]})'>                   
                    </ext:GroupingSummary>
                </Features>
                        </ext:GridPanel>
                    </Items>
                </ext:Panel>
                 <ext:FormPanel ID="FormPanelNazione" runat="server" ButtonAlign="Right" Height="185"
                    BodyPadding="10" Padding="3"  Region="Center" Title="Nazioni...">   
                   <FieldDefaults LabelWidth="70" /> 
                   <FieldDefaults ReadOnly="false" />               
                    <Items>
                         <ext:ComboBox ID="ComboBoxContinenti" 
                runat="server" 
                StoreID="Store1" 
                Editable="true"
                DisplayField="ConDes"
                ValueField="ConId"
                TypeAhead="true" 
                QueryMode="Local"
                ForceSelection="true"
                EmptyText="Select a state..."
                SelectOnFocus="true" ReadOnly="false">            
            </ext:ComboBox>
                         <ext:TextField ID="txtNazCod" runat="server"  Width="180" AllowBlank="false"
                            BlankText="*Obbligatorio" MaxLength="4" MaxLengthText="*Lunghezza massima 4 caratteri."
                            FieldLabel="Codice" Name="NazCod" FieldCls="txtObbligatorio">
                            <ToolTips>
                                <ext:ToolTip ID="ToolTipNazCod" runat="server" Title="Codice" Html="Codice della nazione">
                                </ext:ToolTip>
                            </ToolTips>
                        </ext:TextField>
                        <ext:TextField ID="txtNazDes" runat="server"  AnchorHorizontal="100%" AllowBlank="false"
                            BlankText="*Obbligatoria" MaxLength="50" MaxLengthText="*Lunghezza massima 50 caratteri."
                            FieldLabel="Nazione" Name="NazDes" FieldCls="txtObbligatorio">
                            <ToolTips>
                                <ext:ToolTip ID="ToolTipNazDes" runat="server" Title="Continente" Html="Descrizione dela nazione" />                          
                            </ToolTips>
                        </ext:TextField>
                        <ext:DisplayField runat="server" ID="dspConDes" Name="ConDes"></ext:DisplayField>
                    </Items>
                   <Buttons>
                    <ext:Button runat="server" Text="Save" Icon="Disk">
                        <DirectEvents>
                            <Click OnEvent="Save">
                                <ExtraParams>
                                 <ext:Parameter Name="NazId" Value="#{GridPanelNazioni}.getSelectionModel().getLastSelected().get('NazId')" Mode="Raw" />
                                </ExtraParams>
                            </Click>
                        </DirectEvents>
                    </ext:Button>
                   </Buttons>
                </ext:FormPanel>
            </Items>
        </ext:Viewport>
          <script type="text/javascript">
    
    
              //Carica il record dalla griglia nella form e abilita i button.    
              function enableButtonRowSelect(record) {
    
                  if (record != null) {
                      App.FormPanelNazione.getForm().loadRecord(record);                 
                      App.FormPanelNazione.setTitle(record.data["NazDes"]);
                      App.ComboBoxContinenti.setValue(record.data["ConId"]);
                  };
              };
    
             
    
        </script>
        </form>
    
    </body>
    </html>
    Code page:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Ext.Net;
    
    namespace ARWebRevolution
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Store1.DataSource = new object[]
                                        {
                                            new object[] { "1", "Eu", "Europa" },
                                            new object[] { "2", "As", "Asia" },
                                            new object[] { "3", "Oc", "Oceania" },
                                            new object[] { "4", "Am", "America" }
                                        };
                Store1.DataBind();
    
                Store2.DataSource = new object[]
                                        {
                                            new object[] { "1","Europa","1","IT", "Italia" },
                                            new object[] { "2","Asia" ,"2", "CN", "Cina" },
                                            new object[] { "4","America" ,"3", "CA", "California" }
                                        };
    
            }
    
            protected void  Save (object sender, DirectEventArgs e)
            {
                dspConDes.Text = ComboBoxContinenti.SelectedItem.Text;
                FormPanelNazione.UpdateRecord();
                Store2.GetById(e.ExtraParams["NazId"]).Commit();
                Store2.Group("ConDes");
            }
        }
    }
    tanks for the help

    Aurelio
    Last edited by Daniil; Mar 07, 2012 at 8:24 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Quote Originally Posted by Aurelio View Post
    If you reselect "Europa" from the combo the summary work OK...
    Well, I can't select any item on this stage. When I expand the ComboBox, there is the mask which doesn't allow me to select any item.

    Here is the screen-shot how it looks:
    Click image for larger version. 

Name:	ComboBox.JPG 
Views:	58 
Size:	11.4 KB 
ID:	3881

    So, I can't follow the further steps you have provided.

    Do you use any fix for this which we suggested in the previous threads? I just can't remember it.
  3. #3
    Hi Daniil, there is no fix for this problem will be corrected in the next release as a response in the previous post
    http://forums.ext.net/showthread.php...omboboxes-Mask
    , to test write directly into the combo the value..it's work..

    Daniil, i resolved the problem of mask modified the classes.js in the source code, insert the line:

    loadMask: me.queryMode === 'local' ? false : true

     createPicker: function() {
            var me = this,
                picker,
                menuCls = Ext.baseCSSPrefix + 'menu',
                opts = Ext.apply({
                    pickerField: me,
                    selModel: {
                        mode: me.multiSelect ? 'SIMPLE' : 'SINGLE'
                    },
                    floating: true,
                    hidden: true,
                    ownerCt: me.ownerCt,
                    cls: me.el.up('.' + menuCls) ? menuCls : '',
                    store: me.store,
                    displayField: me.displayField,
                    focusOnToFront: false,
                    pageSize: me.pageSize,
                    tpl: me.tpl,
                    loadMask: me.queryMode === 'local' ? false : true
                }, me.listConfig, me.defaultListConfig);
    
            picker = me.picker = Ext.create('Ext.view.BoundList', opts);
            if (me.pageSize) {
                picker.pagingToolbar.on('beforechange', me.onPageChange, me);
            }
    
            me.mon(picker, {
                itemclick: me.onItemClick,
                refresh: me.onListRefresh,
                scope: me
            });
    
            me.mon(picker.getSelectionModel(), {
                'beforeselect': me.onBeforeSelect,
                'beforedeselect': me.onBeforeDeselect,
                'selectionchange': me.onListSelectionChange,
                scope: me
            });
    
            return picker;
        }
    Waiting for new version

    Tanks
    Aurelio
  4. #4
    Hi, Daniil
    I solved the problem fix the ext library in the source code, but not knowing extjs, I do not know if I did damage the rest of the operation of summary..
    Here is the code modified, bold is the code insert in the method:


    if (summaryData == null) {
    return null;
    }


    if (me.summaryGroups[index - 1] != null) {
    var name = me.summaryGroups[index - 1].name
    var active = me.summaryData[name]
    };


     getColumnValue: function (column, summaryData) {
    
            if (summaryData == null) {
                return null;
            }
    
            var comp = Ext.getCmp(column.id),
                value = summaryData[column.id],
                renderer = comp.summaryRenderer;
    
            if (renderer) {
                value = renderer.call(
                    comp.scope || this,
                    value,
                    summaryData,
                    column.dataIndex
                );
            }
            return value;
        },
    getPrintData: function(index){
            var me = this,
                columns = me.view.headerCt.getColumnsForTpl(),
                i = 0,
                length = columns.length,
                data = []
                if (me.summaryGroups[index - 1] != null) {
                var name = me.summaryGroups[index - 1].name
                var active = me.summaryData[name]
            };
                
            for (; i < length; ++i) {
                column = columns[i];
                column.gridSummaryValue = this.getColumnValue(column, active);
                data.push(column);
            }
            return data;
        },
    I change this in all the library, now work ok...

    I look forward to your fix, surely more correct.

    Tanks
    Aurelio
  5. #5
    Well, I don't think you need to use the GroupingSummary feature, you might use just the Grouping one.

    Example
    <Features>
        <ext:Grouping 
            runat="server" 
            GroupHeaderTpl='{name} ({[values.rows.length]} {[values.rows.length > 1 ? "Nazioni":"Nazione"]})' />
    </Features>
    It appears to work ok.

    Anyways, thanks for the report. I think it should work with GroupingSummary as well. And it works with the latest sources, I've just checked it up. So, it will work in the next release.
  6. #6
    Hi Daniil....It 's just that I use Ext.Net not know well and all commands...

    Tanks for you patience, I will try Grouping one.

    Aurelio

Similar Threads

  1. Replies: 2
    Last Post: May 08, 2012, 3:34 PM
  2. Replies: 17
    Last Post: Oct 12, 2011, 4:54 PM
  3. Replies: 4
    Last Post: Jan 25, 2011, 10:39 AM
  4. Replies: 2
    Last Post: Jul 29, 2009, 1:57 PM
  5. [CLOSED] AjaxMethod Error = BADRESPONSE: Syntax error
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 05, 2008, 6:37 PM

Posting Permissions