The snapshot is a nice feature to rollback changes. I am trying to understand when to use it and when to use refresh row. For example if you have a panel with a grid and a panel for editing a record. When the user makes changes and wants to cancel the transaction, I would think you would just use refresh row api call. I can see the best use of the snapshot is when you let people edit in a grid and they can make multiple changes to multiple rows. Cancel those and a snapshot comes in handy. But I guess you could also just re-query the grid although you would loose you position in the dataset.

What other scenarios would using the snapshot be useful.

asked 08 Mar '14, 21:19

Raymond's gravatar image

Raymond
24323
accept rate: 0%


Hi Raymond,

As you mentioned, we always recommend the refresh row API call for a single row refresh.

In multiple rows refresh case, if the number of rows existing in your datasource is small (<100-200), you can retrieve the primary key value of the current row(to keep the position in the dataset), re-query the grid and then use api_datasource.setCurrentRowByPK API to set the last current row as current again and keep your old position. But remember that when you re-query your datasource, your dataset may be changed since some rows may be added, deleted or updated since your last query. However in snapshot case, you always work with the same dataset as queried at a given point of time.

In multiple rows refresh case, if the number of rows existing in your datasource is huge and the number of the edited rows is small, you can use api_datasource.getQuery API to loop edited rows and refresh them one by one using refresh API.

In our experience, the best use of the snapshot is when you need a savepoint similar sturucture, which is a very rare case.

To cancel the changes, we often use refresh API or the re-query options (or api_datasource.clear API if your grid will no longer be visible to the user).

Hope this helps,
Ibrahim

link

answered 10 Mar '14, 08:58

Ibrahim%20Sandalli's gravatar image

Ibrahim Sand... ♦♦
1.5k5
accept rate: 25%

Thanks Ibrahim that is a very helpful explanation.

(10 Mar '14, 09:03) Raymond
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×1

Asked: 08 Mar '14, 21:19

Seen: 533 times

Last updated: 10 Mar '14, 09:04

Related questions


© Copyright Gerger 2017