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

コード ビハインドに DataChanged ダイレクト イベント ハンドラを (どこかに?) 追加し、次のリクエスト中にそのハンドラを readd しないと推測できます。

この例外は、リクエストがダイレクト イベント リクエストであり、ウィジェットにイベントのハンドラーがアタッチされていないことをリソース マネージャーが検出した場合に発生します。

問題のあるページの生成された JavaScript コードを投稿できますか?

于 2013-05-21T22:07:25.467 に答える
1

これは少しトリッキーですが、ページ 'A' に戻ったときに、プログラムがイベントのハンドラーを見つけようとしていると思われますDataChanged。暗闇での合計ショット...DirectEvents要素に上記のイベントを追加してみてください。

:OPのリクエストに応じて、これを回答として投稿しています。それはもともとコメントにありました。

于 2013-05-21T18:40:32.573 に答える