[CLOSED] How can I pass store data on button click direct event

  1. #1

    [CLOSED] How can I pass store data on button click direct event

    Hi there, I have written a master detail application using form and grid. For each one I have defined an individual store. I want now to be able to pass stores data back to server on a button click direct event I have defined to save document changes. I have tried to define an extra param and set value to
    #{store1}.data.items with no result. Any hint?
    Last edited by Daniil; Nov 29, 2013 at 1:02 PM. Reason: [CLOSED]
  2. #2
    Hi @jstifel,

    Please look at this example.
    https://examples2.ext.net/#/GridPane...mit_Two_Grids/
  3. #3
    OK, great. One more question, is there any way to retrieve what records where updated, deleted and inserted? I would like to be able to browse across the recordset and see which are the operations I have to submit to database based on store information. I have seen the examples showing how to do this using store events but taking in consideration I want to submit 2 different stores information I have not been able to realize how.
  4. #4
    I found there is a method for a store called getChangedData. I tried to use it as value for the parameter (#{Store2}.getChangedData) I pass back to server on button click event but always get an empty parameter "{}" back on server side procedure. I believe the only thing differently I do regarding store updates is that I make them on server side using a ext.net.modelproxy variable via the Set and Commit methods. Is it there a problem in doing it this way? Should I always try to update the store on client side?
  5. #5
    Hello!

    Try to look at this example: https://examples2.ext.net/#/GridPanel/Update/Batch/

    It shows a way how you can get updated records without StoreEvents
  6. #6
    Yes, thank you. I did it and modified my code to use getChangedData as value parameter. Here goes example:

                               <extnet:Button ID="btnSave" runat="server" Text="Salvar" Icon="DatabaseSave">
                                    <DirectEvents>
                                        <Click OnEvent="SaveDocument">
                                            <ExtraParams>
                                                   <extnet:Parameter Name="items" Value="#{Store2}.getChangedData()" Mode="Raw" Encode="true" />
                                            </ExtraParams>
                                        </Click>
                                    </DirectEvents>
                                </extnet:Button>
    Now, back on SaveDocument when evaluating items parameter I always get "{}", like if no changes have been made to the store, which I know is not because before clicking btnSave I have modified the store by the mean of another code behind procedure that goes like:

        Protected Sub SaveItem(ByVal sender As Object, ByVal args As DirectEventArgs)
            Try
                 If fline_num.Text <> "" Then
                    Dim sdr As Ext.Net.ModelProxy
                    sdr = Store2.GetById(PsaConvert.ObjToInt(fline_num.Text))
                    sdr.Set("PART_CODE", fpart_code.Text)
                    sdr.Set("DESC_TEXT", fpart_desc.Text)
                    sdr.Set("SERIAL_CODE", fserial_code.Text)
                    sdr.Set("UOM_CODE", fuom_code.Text)
                    sdr.Set("UOM_QTY", fuom_qty.Text)
                    sdr.Set("DISC_CODE", fdisc_code.Text)
                    sdr.Set("DISC_PER", fdisc_per.Text)
                    sdr.Set("PRICE_AMT", ftaxedunitprice_amt.Text)
                    sdr.Commit()
                End If
                Notification.Show(New NotificationConfig With {.Title = "Item", .Html = "Item salvado"})
                ItemWindow.Close()
            Catch ex As Exception
                args.Success = False
                args.ErrorMessage = ex.Message
            End Try
        End Sub
    I can tell that the store is well updated back on client side because I can see the grid changed it values.

    Could it be that the problem is that when updating the store code-behing using Ext.Net.ModelProxy this changes are not taken in consideration by the getChangedData method?
  7. #7
    A record is not being considered as an update one because of this call:
    sdr.Commit()
  8. #8
    It worked perfectly. Thank you very much for you great support. Can close the case now.

Similar Threads

  1. Replies: 6
    Last Post: Apr 30, 2013, 1:44 PM
  2. Replies: 0
    Last Post: Oct 12, 2012, 3:46 PM
  3. [CLOSED] Load MultiSelectCombobox during button click direct event
    By OSYS_FMS in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Oct 02, 2012, 1:30 PM
  4. Replies: 8
    Last Post: Sep 10, 2012, 6:38 AM
  5. Replies: 0
    Last Post: May 20, 2009, 6:59 PM

Tags for this Thread

Posting Permissions