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
385
Add new record to first grid row via JavaScript ?
posted

I'm using some JS similar to this to add a new row to my WebDataGrid:

grid = $find('WebDataGrid1'); // get a reference to the grid
values = new Array(grid.get_columns().get_length()); // create a new empty row
grid.get_rows().add(values) // add the new row

and it works great except that it ads the row to the bottom of the grid, and I want it to add to the top of the grid. Is there a way to do that?

Thanks,

Walter

Parents
  • 33839
    Verified Answer
    posted

    Hi ssd,

    We simply append a record to the DataSource.  You have two options.  You could either have a hidden sorted field that you use to place the new record first.  It would just need a smaller int than the first previous row.  Or you can do manual CRUD.  Here, you would add it to the DataSource and it would be up to you to prepend it to the DataSource so that the grid displays the new data first.

    regards,
    David Young 

Reply Children