3

首先,让我向您介绍我在屏幕中遇到的异常。

The control 'Store1' does not have an DirectEvent with the name 'DataChanged' or the handler is absent 

我的项目中有一些页面,当我进入页面“A”并切换到页面“B”然后按退格键(所以我转到最后一页)时,我得到了那个错误。但是如果我转到页面“B”并改回“A”,我不会收到错误。

我注意到发生错误时,我添加的列不存在,并且由于绑定到 ext.Store 是在页面未回发时发生的,因此我无法查看已通过的值。

现在,这是包含 ext.Store 的网格:

<ext:GridPanel id="GridPanel1" idmode="Explicit" runat="server" autoheight="true"
        title="Solicitações" autoexpandcolumn="Descricao">
        <Store>
            <ext:Store ID="Store1" runat="server" GroupField="solCodigo" GroupOnSort="true">
                <Reader>
                    <ext:JsonReader IDProperty="solCodigo">
                        <Fields>
                            <ext:RecordField Name="solCodigo" SortDir="DESC" />
                            <ext:RecordField Name="solDescricao" Type="String" />
                            <ext:RecordField Name="solStatus" Type="String" />
                            <ext:RecordField Name="proDescricao" Type="String" />
                            <ext:RecordField Name="solDataSolicitacao" Type="Date" />
                            <ext:RecordField Name="solDataPrevista" Type="Date" />
                            <ext:RecordField Name="solNumArquivos" />
                            <ext:RecordField Name="funNomeSolucionador" Type="String" />
                            <ext:RecordField Name="solPrioridade" />
                            <ext:RecordField Name="solDataSolucao" Type="String" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
        </Store>
        <View>
            <%--
            <ext:GroupingView runat="server" HideGroupedColumn="true" EmptyGroupText="Indefinido" ID="groupingView1" EnableGrouping="false" EnableGroupingMenu="false">
                <GetRowClass Fn="getRowClass" />
            </ext:GroupingView>--%>
        </View>
        <ColumnModel runat="server">
            <Columns>
                <ext:Column DataIndex="solCodigo" Header="Código" Width="40">
                </ext:Column>
                <ext:Column ColumnID="Descricao" Header="Descrição" DataIndex="solDescricao">
                    <Renderer Format="Ellipsis" FormatArgs="50" />
                    <Commands>
                        <ext:ImageCommand CommandName="Comando" />
                    </Commands>
                    <PrepareCommand Fn="prepareCellCommand" />
                </ext:Column>
                <ext:DateColumn Header="Solicitado em" DataIndex="solDataSolicitacao">
                </ext:DateColumn>
                <ext:DateColumn Header="Data prevista" DataIndex="solDataPrevista">
                </ext:DateColumn>
                <ext:Column ColumnID="Projeto" Header="Projeto" DataIndex="proDescricao">
                </ext:Column>
                <ext:Column Header="Situação" DataIndex="solStatus">
                    <Renderer Fn="situacaoRender" />
                </ext:Column>
                <ext:Column Header="Data de Solução" DataIndex="solDataSolucao">
                </ext:Column>
                <ext:Column Header="Prioridade" DataIndex="solPrioridade">
                    <Renderer Fn="prioridadeRender" />
                </ext:Column>
            </Columns>
        </ColumnModel>
        <DirectEvents>
            <DblClick OnEvent="GridPanel1_DblClick" Before="if(#{GridPanel1}.getSelectionModel().getSelected() == undefined) return false; ">
                <EventMask ShowMask="true" />
                <ExtraParams>
                    <%-- or can use params[2].id as value --%>
                    <%-- <ext:Parameter Name="id" Value="#{GridPanel1}.getSelectionModel().getSelected().id;"
                        Mode="Raw" />--%>
                    <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanel1}.getRowsValues({selectedOnly:true}))"
                        Mode="Raw" />
                </ExtraParams>
            </DblClick>
        </DirectEvents>
        <Plugins>
            <%--  <ext:RowExpander ID="RowExpander1" runat="server" >
                <Template ID="Template1" runat="server">
                    <Html>
                        <p><b>Detalhes:</b> {solDescricao}</p>
                        <p><b>Arquivos:</b> {solNumArquivos}</p>
                    </Html>
                </Template>
            </ext:RowExpander>--%>
        </Plugins>
        <SelectionModel>
            <ext:RowSelectionModel runat="server" SingleSelect="true" />
        </SelectionModel>
    </ext:GridPanel>

以及它是如何绑定的

 DataTable dtSol = new DataTable();
                dtSol = sol.Listar();
                DataTable dtResult = new DataTable();
                dtResult.Columns.Add("solCodigo", typeof(int));
                dtResult.Columns.Add("solDescricao", typeof(string));
                dtResult.Columns.Add("solDataSolicitacao", typeof(DateTime));
                dtResult.Columns.Add("solDataPrevista", typeof(DateTime));
                dtResult.Columns.Add("proDescricao", typeof(string));
                dtResult.Columns.Add("solStatus", typeof(string));
                dtResult.Columns.Add("solPrioridade", typeof(int));
                dtResult.Columns.Add("solDataSolucao", typeof(string));

                var result = from r in dtSol.AsEnumerable()
                             select dtResult.LoadDataRow(new object[] 
                             {
                                 r.Field<int>("solCodigo"),
                                 r.Field<string>("solDescricao"),
                                 r.Field<DateTime>("solDataSolicitacao"),
                                 r.Field<DateTime>("solDataPrevista"),
                                 r.Field<string>("proDescricao"),
                                 r.Field<string>("solStatus"),
                                 r.Field<int>("solPrioridade"),
                                 r.Field<DateTime>("solDataSolucao") > DateTime.Now.AddMinutes(1) ? string.Empty : r.Field<DateTime>("solDataSolucao").ToString("dd/MM/yyyy")
                             }, false);

                this.Store1.DataSource = result.ToList().Any() ? dtResult : new DataTable();

                this.Store1.DataBind();

提前致谢。

编辑用户请求

protected void GridPanel1_DblClick(object sender, DirectEventArgs e)
        {
            //string ID = e.ExtraParams["id"];
            string json = e.ExtraParams["Values"];

            json = json.Replace("solNumArquivos\":\"\"", "solNumArquivos\":0");

            clSolicitacao sol = JSON.Deserialize<List<clSolicitacao>>(json).First();
            if (sol.solStatus == "DF")
            {
                Response.Redirect("Chamado.aspx?codigo=" + sol.solCodigo);
            }
            else
            {
                Response.Redirect("ExibirChamado.aspx?codigo=" + sol.solCodigo);
            }


        }

编辑 2

Ext.onReady(function(){Ext.QuickTips.init();Ext.apply(Ext.net.DirectMethods, { EfetuaLogout:function(blnLogout,config){Ext.net.DirectMethod.request("EfetuaLogout",Ext.applyIf(config || {}, {params:{blnLogout:blnLogout}}));} });new Ext.net.LinkButton({id:"menuBuscar",labelAlign:"top",renderTo:"menuBuscar_Container",width:50,arrowAlign:"bottom",iconAlign:"top",iconCls:"icon-magnifier",menu:{id:"ctl00",xtype:"menu",width:140,items:[{id:"ctl01",xtype:"menutextitem",text:"Código:"},{id:"txtBusca",xtype:"textfield",autoCreate:{"tag":"input","type":"text","maxlength":7,"autocomplete":"off"},maxLength:7,directEvents:{specialkey:{fn:function(el,e){var params=arguments;Ext.net.DirectEvent.confirmRequest({formProxyArg:"Form1",eventMask:{showMask:true,msg:"Buscando solicitações..."},before:function(el, type, action, extraParams){return e.getKey() == Ext.EventObject.ENTER;},control:this,action:'SpecialKey'});},delay:20}}},{id:"ctl02",iconCls:"icon-magnifier",text:"Buscar",directEvents:{click:{fn:function(el,e){var params=arguments;Ext.net.DirectEvent.confirmRequest({formProxyArg:"Form1",eventMask:{showMask:true,msg:"Buscando solicitações..."},control:this});},delay:20}}}]},text:"Buscar solicitação"});new Ext.net.GridPanel({store:this.Store1=new Ext.ux.data.PagingStore({proxyId:"Store1",autoLoad:true,reader:new Ext.data.JsonReader({fields:[{name:"solCodigo",sortDir:"DESC"},{name:"solDescricao",type:"string"},{name:"solStatus",type:"string"},{name:"proDescricao",type:"string"},{name:"solDataSolicitacao",type:"date",dateFormat:"Y-m-dTh:i:s"},{name:"solDataPrevista",type:"date",dateFormat:"Y-m-dTh:i:s"},{name:"solNumArquivos"},{name:"funNomeSolucionador",type:"string"},{name:"solPrioridade"}],idProperty:"solCodigo"}),directEventConfig:{formProxyArg:"Form1"},groupField:"solCodigo",groupOnSort:true,proxy:new Ext.data.PagingMemoryProxy([{"solCodigo":2213,"solDataSolicitacao":"2013-04-16T11:16:23","solDataPrevista":"2013-04-17T11:16:23","solPrioridade":3,"solDescricao":"Gostaria de ter acesso a base dbCOEServiceDesk do servidor BRSPTP09.\r\n\r\nO motivo do pedido &#233; para poder aplicar testes e implementar o pr&#243;prio sistema do ServiceDesk assim como foi relatado nas pend&#234;ncias relatadas pelo Silva, Paulo Roberto da.\r\n\r\nO usu&#225;rio para qual o acesso &#233; solicitado &#233; &quot; aseixas &quot;. O mesmo do solicitante deste chamado.\r\n\r\nGrato.","solStatus":"SP","proDescricao":"CrCt(Petrobrás) - SP","funNomeSolucionador":"DANIELA BRITO COSTA                               ","solNumArquivos":0},{"solCodigo":2214,"solDataSolicitacao":"2013-05-10T15:33:11","solDataPrevista":"2013-05-11T15:33:11","solPrioridade":3,"solDescricao":"sdfgdf","solStatus":"SF","proDescricao":"Consiste","funNomeSolucionador":"ANDRE SILVA DE SEIXAS                             ","solNumArquivos":0},{"solCodigo":2215,"solDataSolicitacao":"2013-05-13T13:43:34","solDataPrevista":"2013-05-14T13:43:34","solPrioridade":3,"solDescricao":"abc","solStatus":"SP","proDescricao":null,"funNomeSolucionador":null,"solNumArquivos":0},{"solCodigo":2216,"solDataSolicitacao":"2013-05-13T13:45:06","solDataPrevista":"2013-05-14T13:45:06","solPrioridade":3,"solDescricao":"abc","solStatus":"SP","proDescricao":null,"funNomeSolucionador":null,"solNumArquivos":0},{"solCodigo":2217,"solDataSolicitacao":"2013-05-13T13:47:01","solDataPrevista":"2013-05-14T13:47:01","solPrioridade":3,"solDescricao":"abc","solStatus":"SP","proDescricao":null,"funNomeSolucionador":null,"solNumArquivos":0},{"solCodigo":2218,"solDataSolicitacao":"2013-05-13T13:52:43","solDataPrevista":"2013-05-14T13:52:43","solPrioridade":3,"solDescricao":"asdf","solStatus":"SP","proDescricao":"Connector","funNomeSolucionador":null,"solNumArquivos":0},{"solCodigo":2219,"solDataSolicitacao":"2013-05-13T13:56:17","solDataPrevista":"2013-05-14T13:56:17","solPrioridade":3,"solDescricao":"asd","solStatus":"SP","proDescricao":"Connector","funNomeSolucionador":null,"solNumArquivos":0}], false),directEvents:{datachanged:{fn:function(store){var params=arguments;Ext.net.DirectEvent.confirmRequest({formProxyArg:"Form1",control:this,action:'DataChanged'});},delay:20}}}),id:"GridPanel1",renderTo:"GridPanel1_Container",autoHeight:true,title:"Solicitações",autoExpandColumn:"Descricao",sm:this.ContentPlaceHolder1_ctl00=new Ext.grid.RowSelectionModel({proxyId:"",singleSelect:true}),selectionMemory:false,cm:this.ContentPlaceHolder1_ctl01=new Ext.grid.ColumnModel({proxyId:"",defaultSortable:true,columns:[{dataIndex:"solCodigo",header:"Código",width:40},{dataIndex:"solDescricao",header:"Descrição",id:"Descricao",renderer:function(value){return Ext.util.Format.ellipsis(value,50);},commands:[{command:"Comando"}],isCellCommand:true,prepareCommand:prepareCellCommand},{dataIndex:"solDataSolicitacao",header:"Solicitado em",xtype:"datecolumn",format:"d/m/Y"},{dataIndex:"solDataPrevista",header:"Data prevista",xtype:"datecolumn",format:"d/m/Y"},{dataIndex:"proDescricao",header:"Projeto",id:"Projeto"},{dataIndex:"solStatus",header:"Situação",renderer:situacaoRender},{dataIndex:"solPrioridade",header:"Prioridade",renderer:prioridadeRender}]}),directEvents:{dblclick:{fn:function(e){var params=arguments;Ext.net.DirectEvent.confirmRequest({formProxyArg:"Form1",extraParams:{Values:Ext.encode(GridPanel1.getRowsValues({selectedOnly:true}))},eventMask:{showMask:true},before:function(el, type, action, extraParams){if(GridPanel1.getSelectionModel().getSelected() == undefined) return false; },control:this,action:'DblClick'});},delay:20}}});new Ext.Window({id:"wndChromeWarning",hidden:true,renderTo:Ext.get("Form1"),height:220,width:400,closable:false,buttons:[{id:"ctl03",xtype:"button",text:"Fechar aviso",listeners:{click:{fn:function(el,e){wndChromeWarning.hide()}}}}],header:false,padding:25,contentEl:"wndChromeWarning_Content",modal:true});});Ext.net.ResourceMgr.init({id:"ctl00$ResourceManager1",BLANK_IMAGE_URL:"/extjs/resources/images/gray/s-gif/ext.axd",aspForm:"Form1"});
4

2 回答 2

1

这有点棘手,但我怀疑当您返回页面“A”时,程序正在尝试查找DataChanged事件的处理程序。在黑暗中完全射击......也许尝试将所述事件添加到DirectEvents元素中。

注意:我应 OP 的要求将此作为答案发布。它最初是在评论中。

于 2013-05-21T18:40:32.573 回答
1

我可以猜到您在后面的代码中添加(某处?)DataChanged 直接事件处理程序,并且在下一个请求期间不读取该处理程序

如果资源管理器检测到请求是直接事件请求并且小部件没有附加的事件处理程序,则会发生该异常

您可以为问题页面发布生成的 javascript 代码吗?

于 2013-05-21T22:07:25.467 回答