jsgrid icon indicating copy to clipboard operation
jsgrid copied to clipboard

insertItem works, then loadData is called

Open Peter-With-A-P opened this issue 6 years ago • 1 comments

I've got a fairly well developed grid with some custom fields and all that stuff, it's generally working really well, but I've noticed that when I add a row using this: insertItem: function(item) { console.log(item); var d=$.Deferred(); $.ajax({ type: "POST", url: "<url>?Action=InsertItem", data: item, dataType: "json" }).done( function(response){ console.info(response); d.resolve(response); } ); return d.promise(); console.log("FinishingInsert"); },

The row is inserted in to my database, and what I believe to be the correct JSON data is returned, but as soon as the insertItem has finished (that's why I log the event to the console) a loadData event takes place. I've stepped through the code and checked through the documentation and can't figure out whether this is the expected behaviour or not.

The grid is initialised with these options:

width:"100%", height:"800px", sorting: true, filtering: true, paging: true, pageSize: 50, pageIndex: 1, pageLoading: true, autoload: false, editing: true, inserting: true,

autoLoad is false because I want the first load of data to be sorted by a specific field, so that happens with the line:

$("#ContactsGrid").jsGrid("sort", { field: "LastName", order: "asc" });

Peter-With-A-P avatar Jul 23 '19 15:07 Peter-With-A-P

something exactly like this happens to me too. i insert data from a form with this line: $("#js-grid").jsGrid("insertItem", formData); and it adds the data but a loadData happens (i don't know from where) and my grid backs to default.

sr-ssh avatar Oct 29 '20 10:10 sr-ssh