|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
Hello,
I am evaluating the grid control and would like to know if it is possibe to mix some server side event handling and some client side event handling. I have a large amount of data and need to handle the sort event on the server side. I want to provide excel type editing and respond (on the client side) to an event that gets fired when the cell is finished editing. Is this possible?
Thanks in advance,
Kyle
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, Yes. You can do that. You will need to: 1. Trigger your JavaScript code when user exits edit mode; 2. Trigger post back inside your JavaScript code; In order to implement the first one, you will need to handle the grid's ClientSideOnCellSelected event. Inside that event handler you can use a global variable to track the currently selected cell, and when the current cell changes, you can check whether the previous selected cell's value has been changed. From there you can carry on whatever logic you would like to perform. (We also have a new build that provides a ClientSideEndEdit event, it will simply your code a little bit, please let us know if you are interested in this new build). Once you are inside your JavaScript code, there are many ways for you to raise a postback and trigger a server side event. The Grid provides one function for you to use: http://doc.essentialobjects.com/library/1/jsdoc.public.grid.raiseitemcommandevent.aspxHowever you are free to use whatever here. For example, you can call __doPostBack (provided by ASP.NET) directly and cause a postback. Hope this helps. Please let us know if you have any more questions. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
I will check that out and post again if need be. Thanks for the quick response.
Kyle
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
Is there a way to determine, on the client side, if the user has clicked a header (for sorting)? I can't seem to override the client side sorting when the user clicks the header.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, If you just want to handle sort on the server side, you don't need to override the client side sorting at all. All you need to do is to set the Grid's RunningMode to Server. That way all excel style editing features remain unchanged, but when you click the column header, the Grid posts back and raises a server side ColumnSort event. You would then handle that event to perform sort. Here is a sample for server running mode: http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\grid_server_modePlease let us know if that works for you. Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
Hi, I have code to handle the sorting on the server side but the problem is I need to save data for every cell change immediately. So I'm trying to do that by handling cell changes on the client side. Then I'm tring to catch when the user clicks the header for sorting and do a postback from client side script. If you can help with that great. If you have an alternative that would be great as well. I'm open to suggestions ;)
Kyle
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
That's exactly what the server running mode does. Server running mode does not mean everything runs on the server. In fact pretty much only sorting and paging runs on the server side in server running mode. You still handle cell changes on the client side the same way. So I would expect you just set your Grid's RunningMode to Server and you would be all set.
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
Sweet, I will give that a try. I was assuming running mode was one or the other. I will let you know.
Kyle
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
That seems to work. In a post above there was mention of a new build that offers the client side event 'ClientSideEndEdit'. I would like to try that build as ClientSideOnCellSelected doesn't seem to fire before the postback when clicking on the header to sort. How can I download that build?
Thanks much,
Kyle
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
Please see your private message for download location. I believe ClientSideEndEdit will be called before the Grid post back for sorting, but there would obviously a conflict if your ClientSideEndEdit also try to raise a postback to save the changes. Only one post back will go through.
Thanks!
|
|
Rank: Newbie Groups: Member
Joined: 2/19/2009 Posts: 8
|
Hi There,
I just installed the release with ClientSideEndEdit in it but I don't see it in the properties of my grid. Any ideas?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
ClientSideEndEdit is not on the Grid object. It's on each GridColumns. You can take a look the demo project, then go to Demos -> Grid -> Features -> Client Side Validation to see how to use this feature.
Thanks!
|
|