Welcome Guest Search | Active Topics | Sign In | Register

How to Bind a Grid using JSON on the Client Options
David
Posted: Wednesday, July 14, 2010 3:45:16 PM
Rank: Advanced Member
Groups: Member

Joined: 10/21/2009
Posts: 39
Is it possible to bind your grid on the client using JSON. If not what do you reccomend to use to bind your grid to data returned from an ajax call? I would like a solution that doesn't use UpdatePanels or Callback panels.
eo_support
Posted: Wednesday, July 14, 2010 4:03:25 PM
Rank: Administration
Groups: Administration

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

You can fill/update the Grid on the client side through the Grid's JavaScript interface, regardless how you get the data you want to fill into the Grid. However this is only recommended if you wish to update a very small number of cells. If you have a lot of cells need to be updated, or the whole Grid need to be updated (maybe your situation), then using the client side interface will lead to serious performance issue because every adding/deleting row can potentially trigger a full refresh of the Grid control.

In that case you must use a server side update. There are two ways to do a server side update: either use an UpdatePanel or CallbackPanel; or use the Callback mode provided by the Grid. Callback mode is slightly faster than UpdatePanel because it does not reload or recreate the Grid control itself, where as Callback mode requires you to "manually" trigger the update with code because by default it only triggers an update when you switch page or change sort order. However both methods perform a page post back the same way as UpdatePanel/CallbackPanel does. There is no way to eliminate this post back.

You can call the Grid's raisesItemCommand event to manually trigger an update:

http://doc.essentialobjects.com/library/1/jsdoc.public.grid.raiseitemcommandevent.aspx

The function requires an "itemIndex", for which you can supply "-1" since you do not care about which item:

Code: JavaScript
//Get the Grid object
var grid = eo_GetObject("grid1");

//Trigger the grid's server side ItemCommand event
grid.raiseItemCommandEvent(-1, "whatever");


You will then handle the Grid's ItemCommand event on the server side to update your Grid.

Hope this helps.

Thanks


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.