We have created a format editor on one column and while moving the mouse it always called editor regardless of we are editing anything or not on that column.
The editor should called at editing time only.
So is there any way we can stop calling editor on mouse move.
We are adding Format editor at initializelayout event at column level.
this.DisplayLayout.Bands[0].Columns[STARTDATE].Editor.DataFilter = new DateValidator.DateTimeStringFilter();
We have tried to put the same code at BeforeCellDeactivate event but still after attaching the column with editor, the editor is called again and again on mouse move.
Does it effect the performance if we have 10,000 records in the grid.
Please provide if there is any solution. We need it asap.
Thanks
Garima Garg said:We have implemented editor on column level in our application.this.DisplayLayout.Bands[0].Columns[STARTDATE].Editor.DataFilter = new DateValidator.DateTimeStringFilter();
This line of code assigns IEditorDataFilter to your STARTDATE column. This will not assign an Editor to the column, but will use the default one provided by the grid.
Garima Garg said:So in that case also it will repaint only one cell or it will repaint all the cells in the column?
Yes, by using above line of code only one cell will repaint when mouse goes into the cell or goes out of the cell.
Garima Garg said:Can you please also share how to implement format editor on cell level and on which event it is best to apply.
If you do need to set different editors for each cell of your grid the best place to do this in InitializeRow event like this:
private void UltraGrid1_InitializeRow(object sender, InitializeRowEventArgs e){ if(e.ReInitialize == true) return; var editor = new FormattedLinkEditor(true); editor.DataFilter = new DateValidator.DateTimeStringFilter(); e.Row.Cells[STARTDATE].Editor = editor;}
var editor = new FormattedLinkEditor(true); editor.DataFilter = new DateValidator.DateTimeStringFilter(); e.Row.Cells[STARTDATE].Editor = editor;}
However, this way you will initialize a lot of editors, which will be a big waste of resources. As user can put only one cell in edit mode you will need only one editor at a time. Therefore, if you plan to use same type of editor for all the cells in a column, I can strongly recommend you to assign the editor to the column in InitializeLayout event like this:
private void UltraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e){ var editor = new FormattedLinkEditor(true); editor.DataFilter = new DateValidator.DateTimeStringFilter(); e.Layout.Bands[0].Columns[STARTDATE].Editor = editor;}
Please let me know if you have any further questions on this matter.
Thank you so much for your answer.
We have implemented editor on column level in our application.
So in that case also it will repaint only one cell or it will repaint all the cells in the column?
Can you please also share how to implement format editor on cell level and on which event it is best to apply.
Hello Garima,
From the code snippet, you provided it seems that your DateTimeStringFilter implements IEditorDataFilter interface. However, I am not sure where your issue is. If your issue is that IEditorDataFilter is called each time, the mouse moves over a grid cell, this is expected behavior. When you move the mouse over the cell, this cell may need to repaint and this involves IEditorDataFilter in the process. However, this should not introduce any performance issues as only one cell is involved in this action. Therefore, if your grid has 100 or 100 000 cells it will take the same time to repaint the cell.
If this is not your issue please let me know what you meant by “is there any way we can stop calling editor on mouse move”? What you mean by calling the editor? What editor is in this context?
Looking forward to your reply.