6 Answers, 1 is accepted
I have prepared an example for you that demonstrates how to change the position of the GridViewNewRow.
Please check the attached project and let me know if it works in your case.
Greetings,
Vanya Pavlova
the Telerik team
Thanks for this. We have added your code as a template for our grids and the NewRow does appear at the bottom. However:
1. It appears at the very bottom of the grid, rather than directly after the last row. Can this be changed?
2. After clicking on the NewRow, there is no horizontal line along the top of the NewRow, which looks a bit strange. Maybe this wouldn't matter if the NewRow was directly after the last row.
While I'm here can I throw in another couple of issues relating to NewRow:
3. Suppose you have 3 columns in your grid. You add a new row by clicking on the NewRow and then fill in data for columns 1, 2 and 3, and press Tab to commit the new row. You then click on the NewRow again. The cursor appears in column 3 (because it was the most recently used column) - I would expect it to appear in column 1. Similarly, if you only fill in data for columns 1 and 2 then press Esc to abandon the NewRow, then click on the NewRow again, the cursor appears in column 2 - again I think it should appear in column 1.
4. After pressing Tab to commit the new row, I would actually like another new row to automatically be added (and the cursor placed in column 1). Then the user would press Esc if they didn't want the new row. This would speed up data entry because there is no need to use the mouse. How would I implement this?
Many thanks for your help.
Ed
The approach demonstrated at previous example was achieved through editing the template the RadGridView and extracting the PART_NewRow from the GridViewScrollViewer. The GridViewNewRow shows up under the horizontal scrollbar. Unfortunately with the current implementation of RadGridView there is no easy way to determine the actual count of an items in RadGridView and position the NewRow exactly after the last GridView and to keep this template synchronized. I hope this is not a show- stopper for you, s that I recommend you to use the default behavior of GridViewNewRow.
Please if you need any further assistance please let me know.
Vanya Pavlova
the Telerik team
I'll start another topic for points 3 and 4 above.
Ed
I've been working on a RadGridView and have turned on the ShowNewRow option. We were adding a new record to the bound viewmodel collection then editing it. Switching to using the NewRow is putting the new row at the top of the datagrid. Strangely, if I look at the sample Silverlight apps it creates the NewRow at the bottom. That is the behaviour I'd like but for some reason its putting it at the top.
I've looked at the default xaml that is being used to for the RadGridView and it looks like it puts it above the Virtualised stack panel. So I'm wondering how the Sample apps put it at the bottom. I can't see any modifications in the code and yet it appears at the bottom.
I can modify the default ControlTemplate but I wonder why I'm not getting the apparently default behaviour? Is the default to put it at the top or below the contents?
thanks,
Stephen
Please let me try to explain how this example works. In the original template of RadGridView you can see the PART_AddNewRow which is attached within a GridViewScrollViewer, which has its own behavior. In this way the GridViewNewRow is shown below the GridViewHeaderRow. The trick to display it to the bottom is just to delete this part from GridViewScrollViewer and to place it outside. In this way you are extracting this part from the original template.
Vanya Pavlova
the Telerik team