Skip to content

How to clear grid?

New Discussion
LUIS LEDESMA
LUIS LEDESMA asked on Mar 12, 2015 1:25 PM

I need to clear a hierarchical grid after user click on Save button, if everything is ok then the user should be able to reuse the same grid to enter new data. How to do that?

Sign In to post a reply

Replies

  • 0
    [Infragistics] Michael H.
    [Infragistics] Michael H. answered on Feb 9, 2015 8:31 PM

    Hello Luis Ledesma,

     

    Thank you for posting to our forums!

    Why do you need to clear out the rows in the grid?  Are you using the grid as a type of input form?  Our grids are designed to display the data they are bound to.  If you have the data in the igGrid's datasource it will continue to display the new data the user entered.  You would need to either remove the data from the datasource or bind the grid to a new, empty datasource.

    Please see this jsFiddle that demonstrates how you could assign a new datasource to an igGrid.

    If you have any further questions or concerns with this, please let me know.

    • 0
      LUIS LEDESMA
      LUIS LEDESMA answered on Feb 16, 2015 9:01 PM

      Thanks Michael. Yes, I am using the grid to let user enter data. I found a way to clear grid's data and reuse the grid after posting:

      $('#MyGrid').igGrid('commit');
      var ds = $("#MyGrid").igGrid("option", "dataSource");
      ds.Records.splice(0, ds.Records.length);
      $("#MyGrid").igGrid('option', 'dataSource', ds);
      $("#MyGrid").igGrid("dataBind");

      But, is there a better way?

      • 0
        LUIS LEDESMA
        LUIS LEDESMA answered on Mar 12, 2015 1:25 PM

        Well, maybe there is no better way 🙁

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
LUIS LEDESMA
Favorites
0
Replies
3
Created On
Mar 12, 2015
Last Post
11 years, 8 months ago

Suggested Discussions

Tags

Created by

Created on

Mar 12, 2015 1:25 PM

Last activity on

Feb 24, 2026 3:20 PM