Hello,
I have a very simple WHDG with Outlook GroupBy. There is only one level of data with group headers.
There are 3 visible columns, 2 of which are editable. The WHDG is bound to a WHDataSource which uses an Object DataSource with Select and Update methods. AutoCRUD is enabled. RowUpdating event is bound. Within the WHDG, the only edits allowed are updates to the 2 columns. No row additions or deletions are allowed. Row Selection is disabled too. Essentially, it is a form with grouped headers.
I have also bound the RowUpodated event and the AJAXResponse client side event to display a running summary of what has been entered in a webdialog on the page. Disabling/deleting both of these does not help fix the following issues.
I initially tried using EditorControls (numeric) for the 2 columns that need editing, but, to isolate the issue I am facing, I have deleted them and am just using the basic cell editing functionality.
I have the following 3 issues:
1. Even without grouping, when I use autoCRUD, the AJAX update is triggered only when row focus changes. Since I have 2 editable columns, editing one column and tabbing over to the 2nd columns in the same row (or using the mouse to activate the cell in the second column) does NOT trigger an AJAX update. (Kinda makes sense since the event is called RowUpdating). However, I need to trigger RowUpdating after any cell is edited. How do I achieve this?
2. With Grouping enabled, the AJAX Update (RowUpdating event) is only triggered for every other row! So, with 2 editable columns and say, 6 rows in a group, I click on the first row, first editable column, change the value and click on the same column in the 2nd row. RowUpdate fires just fine (with the AJAX indicator too). I then change the value there and click on the same column in the third row. RowUpdate does not get triggered!. When I click on the same column in the 4th row and update the value, RowUpdate triggers and updates the backend datasource with both values (row 3 and 4). This behavior continues even between groups (say, last row in Group 1 does not trigger RowUpdate, but, subsequently updating the first row in Group 2 triggers RowUpdate for both rows.). The only pattern is that it is for every other row that is edited. My editing does not have to be sequential. If I edit rows 2, 5, 9, 11 and 20, RowUpdate fires after editing rows 2, 9 and 20. Instead of troubleshooting this, I am thinking that if I can trigger/call RowUpdating after any cell is edited, it will take care of this problem. If so, the solution for both issues is the same. Please advise.
3. When I have my RowUpdated event and AjaxResponse client-side event in place (the code in the AjaxResponse event gets the text from GridResponse and sets the innerHTML of a label in a WebDialog on the same page), after the script in AJaxResponse sets the value in the WebDialog, it doesn't return focus to the activated cell in the WHDG. So, for instance, I edit column 1 on row 1 and then click on column 1 on row 4; RowUpdating fires, RowUpdated fires, AjaxResponse gets the new value, sets the innerhtml of the label in the WebDialog and stops. The cell that I had clicked on (row4, col 1) to edit no longer has focus. I have to click on it again to activate it and put it in editing mode. If I disable RowUpdated and AjaxResponse, I don't have this issue. So, at the end of the AjaxResponse script, how do I activate the cell that the user had clicked on? I am thinking that I use the cell-activating client side event, store the row and col numbers in a variable and activate it in the AjaxResponse. Will this work? If so, can I please get a code snippet that will do this. I am having a very hard time working with the CSOM. Putting the WebScriptManager doesn't seem to be helping since I use a MasterPage.
Please help! I am stuck!
Thanks in anticipation.
Hi,
Thanks for the update. In the meantime please go with the resolution you have till we further look at the scenario you described.
Magued
My apologies for not following up; I've been fighting a couple of deadlines.
After running into numerous user-experience issues during editing (the ones described above and others) with the WHDG and spending almost a week to find workarounds, I found that by disabling AutoCRUD (and the RowIslandUpdating and RowIslandUpdated events) and handling all updates by myself using async PageMethods calls invoked from the CellEditingExited client-side event, I was able to resolve all my issues. The performance improved tremendously too. No more need for kludgy workarounds.
I am sorry, I don't have a sample project to share that demonstrates the issues I was having. But, creating one is very simple. All that you need is a WHDG with Outlook GroupBy. Only one level of grouping. A couple of editable columns with no custom editor controls - just the default cellediting mode. Enable AutoCRUD, add the RowIslandUpdated server-side event with code to modify another web dialog on the page using the AJAXResponse method. To make things more interesting, add a WebDataGrid to the page with completely unrelated (editable) data. Run the page. Try editing individual cells on the WHDG and the grid.
Thanks.
I am following up with you and if you would like any further discussion for this issue.
Thanks for the update. If you would like to add a project that reproduces the issue and I will research it further.
I do have the latest service pack installed. Same issue.
set_activecell() doesn't do anything, because, the cell is active. It just doesn't enter Edit mode (and yes, I do have EnableOnActive="True"). If RowUpdating (or AutoCRUD) is disabled, it works fine.
So, here's my solution. In the AjaxResponse client-side event, I have the following code:
var grid = $find('<%=WHDGrid.ClientID%>'); if (grid) { var cell = grid.get_gridView().get_behaviors().get_activation().get_activeCell();
if (!grid.get_gridView().get_behaviors().get_editingCore().get_behaviors() .get_cellEditing().get_cellInEditMode()) { grid.get_gridView().get_behaviors().get_editingCore().get_behaviors() .get_cellEditing().enterEditMode(cell); } }
This puts the active cell in editing mode.