Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
75
Drag selection of rows
posted

Hi,

I am currently using the ultrawingrid for generating a simple report. The problem I am currently is due to the inherent behaviour of the grid row selection that happens. The exact scenario of my concern is when I click on a particular row on the grid and drag to select the rows further rolling beyond the window size, the scroll appears to jump up and down which gives an impression of wrong behaviour although the selection is being made perfectly. One point to highlight here is that after each row that is selected I have made use of the AfterSelectChange event of the grid which does some processing.

The behaviour is due to the running the AfterSelectChange event after every subsequent selection that I make by dragging the mouse pointer and also for the previously made selection. So to make the point clear, It is like if I select 3 rows in sequence, first row gets selected initiating the select change event, then the selection again starts from 1st row and 2nd row, and then afterselectchage runs for 1st, 2nd , 3rd row. Is there a work around so that the AfterSelectChange method runs only once at the end of selection is complete?

 Thanks,

Murali


  • 1800
    posted

    You can make use of the MouseDown event to select your rows. Since you have AfterSelectChange event after every subsequent selection and if that does some logic, don't disturb it. Use MouseDown to select (drag rows) and this can be done by checking the condition whether the Mouse is released or not.

    Use can use MouseMove also, but there will be a  performance hit too.

    Thanks,

  • 469350
    Offline posted

    Hi Murali,

    What I would suggest is that you use a Timer to create a small delay before you process the selected rows. 

    So inside AfterSelectChange, all you do is start the timer. If the timer is already running, then you stop it and restart it. And then you move the code you have in AfterSelectChange now and place it into the Timer Tick event - and, of course, stop the timer.

    This method will provide a better user experience and is also more efficient, since you don't end up processing the same selected rows multiple times.