Updating multiple grids on save - need design pattern

  1. #1

    Updating multiple grids on save - need design pattern

    *Hi Geoff/Vladimir

    I'm having an issue understanding the process (pattern) of how to update multiple grids on a form save.

    On the client side, I'm displaying a form. This contains :

    * Bunch of text fields
    * Bunch of drop down fields
    * Two Grids (at the moment) Phone Numbers & Email Addresses

    I have a toolbar at the top with a Save button, which submits back to the code behind function (C#).

    When I edit the grids on the front end, I don't want the changes automatically sent back to the server. The system could have a high number of concurrent users, so its best to handle the changed data only when they hit Save.

    At the moment, I can access the Text and Drop Down boxes in the standard way (.Text, .SelectedValue etc). I can't access the updated grid data, either in the Store or Data Object. I saw a similar thread to this before, where you implemented a specific GridView save function. However, I don't understand the design pattern on either the client or server side to get the new data. Ideally I'd like an updated Data Object, but I realise that may be asking a bit much :). Access to the altered Store would probably suffice.

    Could you help explain it a bit further?

    Best regards

  2. #2

    RE: Updating multiple grids on save - need design pattern

    Hi Steve,

    First, you can read this topic
    That is old topic, some information is obsolete but in any way this information can be interesting.

    Some clarification:
    - the grid panel can be saved or submitted.
    **- save mode: initiate by calling 'save' js function of GridPanel. With saving rows grouping three level: Created, Updated and * * * Deleted. So, I you understand, on server passing only modified rows. The save function is using UpdateProxy of Store. You can specify web-service, http handler or any url which will handle submitted data. If update proxy is absent then data will be submitted to the page where define Store/GridPanel. If you use any ASP.NET DataSource object then the Store will automatically parse data and call Insert, Update and Delete operations of DataSource. If not then you can perform this operations manually. You can handle*OnBeforeStoreChanged event of Store and realize own save logic. Also you can handle*BeforeRecordUpdated,*BeforeRecordDeleted,*BeforeRecordInserted server-side events which will be r=fired when grid data submitte to the server.

    - submit mode: initiate by calling 'submitData' of grid panel. In this mode all rows (even unmodified) submitted to the server. You need to handle 'OnSubmitData' event of Store.

    -*Save with SqlDataSource

    - Save to the web-service with confirmation

    - Save to http handler

    -Save to the web-service

    - Save to the page and handle BeforeStoreChange event

    - Save to the page and handle store events*

    -*Submit grid to http handler

    -*Submit grid to the page

    About saving two grids. Unfortunatelly in one request can be saved only one grid. But we can submit two grid using*
    'getRowsValues' function of GridPanel. Please see the follwoing topic which shows how to submit grid in one request

    Hope this help.

  3. #3

    RE: Updating multiple grids on save - need design pattern

    *Hi Vladimir,

    Thank you for you detailed reply. I will go through your examples, but I don't think you quite understand what I'm trying to accomplish.

    When the user clicks the save button on the form, I want to handle the updates of all fields on the form, plus the multiple grids. I can't figure out the design pattern to handle these updates (saves) at the same time. It looks like the grid save (via what ever save/update function) has to be detached from the submission of the form data (plus there are multple grids, which is another issue).

    Ideally I'd like to be able to have the user hit Save, and in the Button Click event in the code behind C# :

    Handle the Text Box updates
    Handle the Drop Box Selection Changes
    Handle the Grid View Updates (via the Data Object)

    I can't see how I can accomplish this if on the client I'm having to call save on the grids first (one after the other) and then submit the form. It feels disconnected. I'm assuming on the client side, the code would look like:

    Possible Current Code:
    (Client) Save Grid Panel 1 -> (Server) Update Data Object 1
    If Error : Show Error To User

    If Success :*(Client) Save Grid Panel 2 -> (Server) Update Data Object 2
    If Error : Show Error To User

    If Success : (Client) Submit Form Data -> Handle Field Updates + Update Database
    If Error : Show Error To User

    If Success : Tell User All Good.

    Ideal Code:
    (Client) Save Form plus Grid -> (Server) Handle Fields + Data Store + Database

    I don't want to update the actual database with the new values until the data objects (grids values) and field values are validated.

    Does this make more sense?



  4. #4

    RE: Updating multiple grids on save - need design pattern

    Hi Steve,

    My last link in previous post shows how to save two grids in one request (plus all form controls will be submit also).
    Please note that when you call 'save' function for grid then all form controls will be submit also but not other grids. We will think about multiple grid saving in one request (i think we will implement it soon). Now you can emulate it as described in**last link in previous post

    If you want I can prepare such example for you. I need example page with grids plus format of converted data (JSON -> RequiredFormat)


Similar Threads

  1. [CLOSED] combobox search pattern
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Dec 17, 2011, 2:39 PM
  2. [CLOSED] Help with Focus/Key Navigation in Search/Results/Detail pattern
    By randy85253 in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Jun 28, 2010, 12:36 PM
  3. Replies: 4
    Last Post: Jun 09, 2010, 6:45 AM
  4. MVC with ViewModel pattern (MVVM)
    By Dominik in forum 1.x Help
    Replies: 1
    Last Post: May 28, 2010, 8:08 AM
  5. Newbies - How to display Coolite on design pattern
    By phancongphuoc in forum 1.x Help
    Replies: 1
    Last Post: Mar 17, 2010, 11:26 AM

Posting Permissions