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
300
Someone please post an example of adding a row using CSOM
posted

I do not want to use asp.net databinding to populate the grid. I'd rather use JSON via $.ajax() and do it all client side.

Can anyone help me by helping me find the design pattern to add rows on the client?

Parents
No Data
Reply
  • 33839
    posted

    Hi HartigenAnthony,

    I would suggest using the client binding capabilities of the grid available in 11.1.  Set EnableClientRendering="true".  Now, you'll have to supply an empty source on the server so that we can render the grid.  Then on the client, you can use ajax to fetch your source, apply it to the grid, and bind.

    var grid = $find('WDG1');

    grid.set_dataSource(yourDSArray);

    grid.applyClientBinding();

    As an aside, if you wanted to add a row completely on the client, you again would have to use client rendering.  You would need to add the new object to your source and reapply client binding.  If you use grid.get_rows().add(itemArray), the grid will attempt to make its own ajax call to add it to the database and rebind on the server.

    regards,

    David Young

Children