|
Rank: Advanced Member Groups: Member
Joined: 10/14/2010 Posts: 19
|
Question on placing an grid row in update mode.
The help documentation and sample shows that "changes are logged on the client side first and then transferred to the server side when the page posts back".
Once a user edits a row I want to process that row for update. How do I do this if the default action is the user must click post back?
My concern is if the user edits a row, then goes to a menu option to go to another page, I then have to handle if they posted the back back or not if they made updates.
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
You can use a ButtonColumn and also set the Grid's RunningMode to "Server" to do the save. In that case when user clicks the ButtonColumn, it will trigger server side ItemCommand event directly (it will also trigger ItemChanged event so that you can save the changes).
Alternatively, you can also handle the Column's ClientSideEndEdit handler to mark that the Grid's content has changed. You can then handle the page's onbeforeunload event and check whether the Grid's content has been changed. If it has, then prompt the user to save the contents. This would offer a user experience that is more inline with a traditional desktop application.
Hope this helps. Please feel free to let us know if you have any more questions.
Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 10/14/2010 Posts: 19
|
eo_support wrote: You can use a ButtonColumn and also set the Grid's RunningMode to "Server" to do the save. In that case when user clicks the ButtonColumn, it will trigger server side ItemCommand event directly (it will also trigger ItemChanged event so that you can save the changes).
Alternatively, you can also handle the Column's ClientSideEndEdit handler to mark that the Grid's content has changed. You can then handle the page's onbeforeunload event and check whether the Grid's content has been changed. If it has, then prompt the user to save the contents. This would offer a user experience that is more inline with a traditional desktop application. Thanks!
Follow up questions. 1. Button column: Are you stating have them click save, or call the post back event of the button column once the user completes the edit? 2. I like the second option you suggested. In this case do you have an example of handling the ClientSideEndEdit? 3. When the data grid runs in client mode (as in the second option you mentioned) I need to be able to filter by columns, sort by columns, then finally allow the user to save. The Live Demo Excel Example (looking at that one for a base) binds a data reader to a grid. Since it does not use a SQL or Object Data source, what is the risk of Timeouts for the Grid in client mode? If the user edits data and finally does a save after 20 minutes will I get a timeout and lose all the changes?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, As to your question: 1. Button column: The user will need to click the button (the button is inside the cell). Clicking the button should post back the whole page if the Grid's RunningMode is set to server; 2. It will be something like this:
Code: JavaScript
var grid_changed = false;
function end_edit_handler(cell, newValue)
{
//Remember that the Grid has been changed
grid_changed = true;
}
Code: HTML/ASPX
<eo:Grid ....>
<Columns>
....
<eo:TextBoxColumn ClientSideEndEdit="end_edit_handler" .... />
....
</Columns>
</eo:Grid>
3. If user must login to access the page, then you will have session time out issue regardless what data source you use. However this has nothing to do with the Grid. The Grid does not make any communication to the server when in client mode (unless you explicitly call raisesItemCommandEvent). In this regard it functions very much like a single textbox. User can type and type and type for an hour and then get session time out when they are finally ready to submit. If that's of a concern, you will need to have some kind of mechanism either on page level or project level to prevent that. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 10/14/2010 Posts: 19
|
I appreciate your quick reply.
|
|