We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Escape key on AddNewRow sometimes skpis RowValidating event and allows to show data.

Good Day,

I have this issue where I click on add new row, then press one time the escape key, click to re-enter to edit mode again and press escape key again and when I leave the row this time the grid does not trigger the validations and add the invalid data or at least it displayed like a new added row  (note: that I have the grid on EditTrigger = OnTap)..

Thanks and Regards

3 Replies

SM Saravanan M Syncfusion Team March 23, 2015 09:41 AM UTC

Hi Angel,

Thank you for Contacting Syncfusion support,

We have analyzed your query. When you Press escape key two times, validation will be clear , this is the behavior of SfDataGrid. But you can keep the validation on by overriding SelectionController and CurrencyManager. Please refer the below code snippet.

Code snippet[C#]:

this.sfDataGrid.SelectionController = new CustomGridSelectionController(this.sfDataGrid);

public class CustomGridSelectionController:GridSelectionController

{ .

.

protected override GridCurrentCellManager CreateCurrentCellManager()

{

var currentcellManager = new CustomCurrentCellManager(this.DataGrid,this.SuspendUpdates,this.ResumeUpdates);

return currentcellManager;

}

.

.

}

public class CustomCurrentCellManager:GridCurrentCellManager

{

public override bool HandleKeyNavigation(KeyEventArgs args, RowColumnIndex rowColumnIndex)

{

if (args.Key == Key.Escape && !this.CurrentCell.IsEditing)

{

return true;

}

return base.HandleKeyNavigation(args, rowColumnIndex);

}

}

We have prepared a sample based on this and you can download it from below location,

Sample Location: SfDataGrid_Validation.zip

Please let us know if you have any other queries,

Regards,

Saravanan.M



AA ANGEL ADRIAN VELAZQUEZ RAMOS March 23, 2015 06:46 PM UTC

Hi Saravanan,

I appreciate the support and the example, but I really want is the user capability to cancel add new row without this little issue that I am facing. 

I couldn´t reproduce the issue with the provided code, so I added a column which has a list of names on a GridMultiColumnDropDownList (silly code might be) as I have it in my grid; 

If you click on addnewrow on CustomerName Column, then trigger the validation (clic outside the row), after that press esc key, clic inside the same column again and finally press esc key again, the next time that you have clicked outside the row, it will allow me to add the row without following the validation.


I know that this might look like a rare case but I think I am using or I am declaring something wrong.



Thanks and Regards,

Angel


Attachment: SampleApplication_c1064a41.rar


SM Saravanan M Syncfusion Team March 25, 2015 12:18 PM UTC

Hi Angel,

We were able to reproduce the problem and wehave logged defect report regarding this. A support incident #137088 to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,

Saravanan.M


Loader.
Up arrow icon