[CLOSED] DataGridView delayed event

Answered
0
0

Hi,

I have a DataGridView about 5000 rows. When I select a row, it will bind the data to another DetailControl (it takes  around 0.2 second to bind data). The problem is when user keep pressing Up/Down keyboard for  few seconds, the selected row in grid is different than the data in the DetailControl. Is any way to avoid it? Is it possible to delay event selectionChanged until user releases key press?

Thanks you for your help,

Page

 

  • You must to post comments
Great Answer
0
0

Hi,

I see the issue, i’m attaching some experimental code that will let you test firing the event after a specific timeout. It prevents the normal selectionChanged and focusCellChanged events from firing to the server and replaces them with events that fire 250ms after the last selection change. If this code works for you, we’ll add it to the DataGridView as an optional property for future builds.

Let me know!

Best,

Levie

 

  • Page Page
    Hi, thanks you, it works but i’m not sure if it is enough. I saw on Github, the code for selectionChanged is more complicated, should i put part of this code to lazySelectionChanged? _onSelectionChanged: function (e) { this.base(arguments, e); if (this.__canFireServerEvent()) { var selectionModel = this.getSelectionModel(); var selectionRanges = selectionModel.getSelectedRanges(); this.fireDataEvent(“selectionChanged”, { ranges: selectionRanges, focusCell: { col: this.getFocusedColumn(), row: this.getFocusedRow() } }); } }, Page
  • Luca (ITG)
    The event is the same. it handles the original “selectionChanged” event on the client and simply delays it and posts to the server reusing the the same data. In any case, we have added an experimental new property DataGridView.SelectionDelay working the same way.
  • You must to post comments
0
0

You can also bind directly to the controls:

  1. Select the control to bind to
  2. In the Property window, expand the DataBindings option
  3. Select the “Text” dropdown
  4. Expand your binding source
  5. Select the appropriate field

Best,

Levie

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.