Welcome Guest Search | Active Topics | Sign In | Register

Client-side detail grid editing Options
infoland
Posted: Monday, December 12, 2011 6:53:59 AM
Rank: Member
Groups: Member

Joined: 11/15/2011
Posts: 24
Hi,

I'm trying to build a detail editor for an EO Grid.
The grid has FullRowMode = False, since I want to handle all data client-side.
Each grid item has some detail data in hidden columns (json) which I want to edit using a popup (EO Dialog) detail grid.
The detail grid may show 0, 1 or more items, depending on the hidden json data.
Also, the detail grid allows to edit, add or delete items.

Starting from main grid item, how do I populate the detail grid, still remaining client-side (no postbacks)?
I was figuring out to add items using grid.addItem Javascript method but it's not so straightforward to me.
In fact, first I have to "clean" previously added items.
I tried using deleteItem, but I discovered they're still kept (they are "marked as deleted and not removed from the Grid's items collection").
This makes impossible to distinguish "real" deleted items from "previous" items.
Is there any "clear" or "empty" method for grid's items collection?

Thanks

eo_support
Posted: Monday, December 12, 2011 11:42:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

The easiest way for you to do this would be putting the detail grid inside an AJAX panel (either our CallbackPanel or ASP.NET UpdatePanel) and then trigger an AJAX update whenever needed. That way you will be able to update the entire Grid every time from server side code without a full post back.

You can also rely on addItem and deleteItem from the client side. But as you have already noticed, when an item is deleted on the client side, they are not really deleted. You can use this method on the client side to determine whether an item is deleted:

http://doc.essentialobjects.com/library/1/jsdoc.public.griditem.isdeleted.aspx

When you use it this way, the deleted items will accumulate until a post back occurs, which can cause other problems if you have a lot items need to be "refreshed" and the page does not post back for a long time. In that case it may make more sense for you to rely on AJAX update.

Thanks!
infoland
Posted: Monday, December 12, 2011 12:59:38 PM
Rank: Member
Groups: Member

Joined: 11/15/2011
Posts: 24
Sure enough, your suggestion fits pretty well to what I ended up doing.

I didn't even need for any AJAX panel: I used Callback running mode together with goToPage Javascript method!
"Temporary" json data to edit in detail grid are then passed back to the server using a hidden input.
Finally, in the the PageIndexChanged server event the detail grid is bound to decoded json data.
And it works!
Thanks.

Cheers



eo_support
Posted: Monday, December 12, 2011 1:02:45 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Oh. Yes. The Grid does have a built-in Callback mode. That should work well for your situation. Sorry that we forgot that!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.