This is a migrated thread and some comments may be shown as answers.

RadGridView with "rollback" ability

1 Answer 132 Views
GridView
This is a migrated thread and some comments may be shown as answers.
hermann
Top achievements
Rank 1
hermann asked on 06 Jul 2011, 03:49 PM
Dear all,
I have to implement a gridview with the following behaviour:
  • User enables a mode (new, update or delete)
  • and when he manipulates some data - let's say changes the contents of a cell - the new contents is displayed bold - to visualize the change.
  • So, after some changes he can press an "update" button and this works like a DB commit - all bold cells are saved and drawn with standard font weight again.
  • If he enters the original value before commit, the font weight should go back to normal.
  • If he presses a "cancel" button, all changed values should switch back to the original ones - and be shown with normal font weight.

Question is where to start?
I have seen the HistoryManager example, which deals with dirty data, this is a little bit more than I need.
There is also a nice example showing the CellStyleSelector using a UnitPriceConveter to change the cell style depending on its contents.

So my theortical approach is:
ItemSource class is an observable collection of IEditableObject items. Each editable item as an "oldvalue" field.
and this is somehow connected to the StyleSelector.

One of the missing parts is, when the user deletes a row, how should this be shown? I have seen other grids, that show a marker on the left side, indicating that this row will be deleted at next save/commit. How difficult is this to achieve?

Has someone done something similar?
Any help would be really appreciated.

Cheers,
Hermann

 

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 11 Jul 2011, 11:37 AM
Hello Hermann,

I would advise you to place a boolean flag in your business object class that will be set to true if the respective row has to be deleted during the current editing session. Meanwhile, you may utilize a RowStyleSelector that colorizes the rows, regarding this flag. When user submits the changes the marked rows will be deleted. Please, let me know if such an approach meets your requirements. Do not hesitate to contact us immediately if any further inquiries occur.

Greetings,
Ivan Ivanov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
GridView
Asked by
hermann
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or