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

In-memory editing

3 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Tx3
Top achievements
Rank 1
Tx3 asked on 15 Nov 2010, 10:51 AM

Hi,

I would like to like have a grid where user can modify data (add, remove and edit) and finally Update changes to the database.

So, clicking delete would not delete data from the database, instead it would remove row from the grid only. Under the grid would be a Save button. Any ideas how to accomplish this kind functionality? Also another question is that how can I access all rows instead of one?

-Tatu

3 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 15 Nov 2010, 11:17 AM
Hi Tx3,

 This is currently not supported. We have it logged as a feature request and you can cast your vote here.

Kind regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Uma
Top achievements
Rank 1
answered on 27 Dec 2010, 07:07 PM
Hi Atanas Korchev
Is there any alternative way to achieve the below requested functionality until the Grid supports it?
Looking forward for your suggestion..

Regards,
Uma
0
Tx3
Top achievements
Rank 1
answered on 27 Dec 2010, 09:43 PM
Hi Uma,

I have used normal form collection to fake inline editing. I use hidden field to identify row and visual data is normally input type of text.

When user adds a empty row:
- form will be posted and each row is in the FormCollection. For example formCollection['id'][2], formCollection['name'][2] would represent row 3 id and name.
- then I'll set previous data + a new empty row to the ViewModel

When used removes a row
- I'll get current situation as describes in the Add
- I give an id of the clicked row to the Action method
- Then I remove that row and again I set previous data - deleted row to the ViewModel

When user edits a row
- I don't save anything in this situation. User-interface will hold the information. Only when new row, delete row or grid save happens then we need to store it (save uses database, others uses in-memory editing)

When user saves complete grid
- I'll get current situation as describes in the Add
- Convert form collection to class and save the information

This is just a rough example how I solved the problem. Even if the example looks "dirty", you can do this quite nicely using good programming practices. :)

-Tatu
Tags
Grid
Asked by
Tx3
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Uma
Top achievements
Rank 1
Tx3
Top achievements
Rank 1
Share this question
or