ext.net按钮单击直接事件

问题描述 投票:0回答:1

我的表单很大,包含许多字段集和网格面板,我需要使用一个确认按钮提交所有数据。其实我在用这个:

<ext:Button runat="server" Text="Finalizar"  Width="150" ID="Button1" Disabled="true">
                    <DirectEvents>
                        <Click OnEvent="SalvarDados" After="#{StoreVerifLimpeza}.sync();">
                            <Confirmation ConfirmRequest="true" Title="Confirmação" Message="Confirm?" />
                            <EventMask ShowMask="true" Msg="Salvando..." />
                        </Click>
                    </DirectEvents>
                </ext:Button>

但是显然after操作在OnEvent之前触发。因为我在SalvaDadosVerifLimpezaGrade_BeforeRecordInserted中设置了一个外来变量,所以该变量为null。我试图找到一些有关directevents click的文档,但发现了任何东西。

asp.net extjs dom-events ext.net gridpanel
1个回答
0
投票

尝试此替代方法:

<script runat="server">
    // c#
    [DirectMethod]
    public void SalvarDados(){
        // ... your code here
    }
</script>

<ext:XScript runat="server">
<sctipt type="text/javascript">
    function finalizar(){
        Ext.Msg.confirm('Confirmação', 'Confirm?', function(btn){
            if (btn == 'yes'){
                showWaitBox();
                App.direct.SalvarDados({
                    success: function(){
                        #{StoreVerifLimpeza}.sync();
                        Ext.MessageBox.close();
                    }
                });
            }
        });
    }

    function showWaitBox(timeout){
        Ext.MessageBox.wait('Salvando...');
        setTimeout(function() { Ext.MessageBox.hide() }, timeout ? timeout : 30000);
    }   
</script>
</ext:XScript>

<ext:Button runat="server" Text="Finalizar"  Width="150" ID="Button1" Disabled="true" Handler="finalizar();">
© www.soinside.com 2019 - 2024. All rights reserved.