I have a XamGrid (2011.2) which when it is in edit mode, and a user navigates to a certain cell, I need to provide an assist. I need to be able to automatically select the existing contents so that they can just start typing to erase the old content.
What I need is something similar to this, except that I need to get access to the textblock contained in the cell. The cell has no such property SelectAll. This is the approach I would use if it was a straight TextBox. Any ideas on this?
Private Sub dgDataEntry_CellEnteringEditMode(sender As Object, e As Infragistics.Controls.Grids.BeginEditingCellEventArgs) Handles dgDataEntry.CellEnteringEditMode Me._intDataEntryIndex = e.Cell.Row.Index Select e.Cell.Column.Key.ToLower() Case "orgabbrvcd" Dim tb As Cell = sender tb.SelectAll() End Select End Sub
sorry, that one line of code should be
dim tb as Cell = e.Cell
HI,
Change the XamGrid's editor settings.
<ig:XamGrid.EditingSettings> <ig:EditingSettings AllowEditing="Hover"/> </ig:XamGrid.EditingSettings>
Click on the XamGrid and mouse over any cell, it will get selected and be in edit mode.
Sincerely,
Matt Developer Support Engineer
HI Alan,
Try these settings
<ig:XamGrid.EditingSettings>
<ig:EditingSettings IsOnCellActiveEditingEnabled="True" AllowEditing="Cell"/>
</ig:XamGrid.EditingSettings>
Sincerely, Matt Developer Support Engineer
I have both of those settings, but I think that I might have figured out what is going on. That field is being prefilled based on the input from a previous cell. So, the flow is, I am in cell 0, I type in something, I leave the cell. Data service is called to get the default value based on cell 0 data input. When it returns asynchronously, it deposits a default value in cell 1. But I think that the grid already started edit mode before the service returns.
Going back to my original description, I need a way to select the contents so the user does not have to. When the service comes back I think the begin edit mode already started. As I see that I get the behavior I want out of the box except for this cell. Other cells which are not populated from a service call select the whole text on begin edit mode.
Hopefully this makes sense. When I look at e.cell.Content on a begineditmode it tells me it is textblock and not a textbox. Textblock does not have a selectall property...
You have a timing issue, I don’t see how you can navigate to cell1 and start editmode until cell 1 has been properly updated. You don’t want your user to be editing a cell that does not have the proper value.
Can you get all the default values from your dataservice ahead of time? If you can, then after cell 0 is modified, you could do a quick look up during the XamGrid’s CellExitingEditMode Event and then populate Cell1 with the value.
Another option would be to use the XamDialogWindow as a modal window, open it while you are exiting editmode of cell 0 . Then call the DataService and wait for it to return with cell1’s value. Once it returns, you could close the XamDialogWindow and begin editing.
Sincerely,MattDeveloper Support Engineer
Hey Matt,
Yeah, that's not going to be practical for me to pull those default values back as they number in the range of 300,000.
I will have to study your second option. Does that have the effect of making the form modal? I have to decide which is a lesser evil. Having the users have to wait for the popup to go away, or not preselecting the text for them under the scenario where they want to use something other than the default value. I would guestimate that they deviate from the default value about 10% of the time.
The users are having to do about 30 records of data entry at a sitting, and it is all numerical and their motions very rote. So, they can for the most part expect that they can do the data entry and navigation required by only using the numeric keypad. I have programmed the grid to respond to the enter key as a way to navigate to next cells, so they should be able to do the entry as fast as they can type. No mouse usage should be required with this grid until they are ready to submit the form.
The XamDialogWindow can be made to be modal by setting its IsModal property to true..
You need to worry about loss of data.
You certainly don't want your users to update the 2nd cell, then move onto the next row only to have the 2nd cell changed by the dataservice call that just comes back late. This would cause data loss.
I think you users need to wait until the dataservice call comes back with an update.
MattDeveloper Support Engineer
Please let me know if you need further assistance regarding this issue.