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
185
Ultragrid - focusing on newly added record.
posted

When we add a new record to ultra grid and save, after reloading all the records - the new record goes down in the grid (according to sorting). How can we mark this new record as selected and let the grid scroll to the record.

Same thing for the updated record. I don't fine any grid event which fires after datasource changes.

  • 469350
    Offline posted

    Hi Chiragkumar,

    I'm having trouble understanding your question. You say you are adding a row to the grid and then you save and reload the data. Why are you reloading the data if its already in the grid? Do you mean you are closing and restarting your app? If so, then there's no way to know that the new row is a new row because it's been committed and it's no longer a new row.

    Did you mean you are adding a row to the data source and not through the grid? If that's the case, then there's still no reason to reload the data, because the grid will automatically respond to a notification from the data source that the new row was added.

    The grid also doesn't automatically re-sort the rows when you add a new row. And why would the new row always move down - unless you are sorting by some sort of key value which is always increasing for new rows?

    The grid doesn't fire events when the data source changes because that doesn't really make sense. The grid RESPONDS to events on the data source. If you want to respond to events on the data source, then the correct way to do that would be to hook events on the Data Source yourself, not hook an even on the grid.

    To mark a row selected, you simply set the Selected property on the row. And to scroll that row into view you would use the ScrollRowIntoView method on the RowScrollRegion. So you would probably want to use the ActiveRowScrlolRegion.

    I'm not sure if any of that helps you, but if not, please clarify for me exactly what you are doing and what you want, and I will try to help you achieve it.