0
votes

I have a big form with many fieldsets and gridpanels and I need to submit all data with one confirm button. Actually I'm using this:

<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>

But apparently the after action is firing before OnEvent. Because I set one foreign in SalvaDados and in VerifLimpezaGrade_BeforeRecordInserted this var is null. I tried to find some documentation of directevents click but found anything.

1

1 Answers

0
votes

Try this alternative:

<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();">