When I click the AddRecord row, I want to create a new DataItem for that record, and set some default values... then I want to automaticlly start edit mode.. how can I accomplish this?
Hello,
I believe this is the same issue here
Alex.
No really. I want the default values to appear when the user clicks the AddRecord, not when he starts typing/editing a cell.. that's 'too late' in my case.
Almost.. I use ComboEditors in my grid, and I -need- to select a value other than the default value in order to create a new dataitem in the list :( but this is for another day... thanks for your assistance :) any other tips regarding this issue are welcome.
Hi,
In this case send me a sceenshot or better a sample solution to be of further assistance
See attachment.
Right now it amost does what I want. What I want is that when the default values are set the underlying dataitem is also created, as in the changed values are commited to the datasource. When edit one of the values this does happen. Can I do this in code?
I experimented a bit with adding dataitems to the bound BindingList. This sort of works, but has side effects.. (for instance, I need to change the activerecord with a command)
Hope this helps.
I have the same problem. The user can initiate some values into the add row. The problem is the Add record's DataItem is null. Is there a convenient way to for the creation of the object?
I looked through the callstack of Infragistics code when the DataItem does get created and found the code path that needs to be followed.
If you find the editor for the first cell - the editor has to be in edit mode otherwise it doesn't follow the same code path. Here's an example. In my situation when a user does a key combination to copy data from a field in the last entered add row (lastAddedRecord - DataRecord) into a field in the new add row (this.ActiveCell)
//this is the XamDataGrid
if (this.ActiveCell.Record.DataItem == null) { CellValuePresenter cvp = CellValuePresenter.FromCell(this.ActiveCell); if (cvp.Editor != null) { this.ActiveCell.Record.DataPresenter.ExecuteCommand(DataPresenterCommands.StartEditMode); ValueEditor editor = cvp.Editor as ValueEditor; editor.Value = this.lastAddedRecord.Cells[this.ActiveCell.Field].Value; }}else { this.ActiveCell.Value = this.lastAddedRecord.Cells[this.ActiveCell.Field].Value;}