insertItem works, then loadData is called
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" });
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.