insertItem problem
See original GitHub issueHello,
I have a problem with the insertItem function.
Here is my code:
var teams= [
{ "Name": "ATLAS" },
{ "Name": "ALICE" },
];
var grid = $("#jsGrid").jsGrid({
//...SOME PARAMS HERE...
data: teams,
fields: [
{ name: "Name", type: "text", width: 150, validate: "required" },
{ type: "control" }
],
insertItem: function (item) {
var d = $.Deferred();
$.ajax({
method: "POST",
url: "/admin/team/insert/",
data: item,
dataType: "json",
}).done(function( data ) {
console.log( "done:" + JSON.stringify(data) );
d.resolve(data);
}).fail(function( msg ) {
console.log( "fail" + msg );
d.reject();
});
return d.promise();
}
});
The data returned from my server is {"Name":"foo"}.
But the new row is never inserted.
My jquery is jquery-3.1.1.min.js. I have tried with jquery-1.11.3.min.js without success.
I have tried to hard code d.resolve({ "Name": "foo" }).
I may have misunderstood how the function work. Where is my mistake ? Thanks. Regards, Thomas
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Problem with wxListCtrl::InsertItem() - Google Groups
Hello, I'm trying to insert a string into my wxListCtrl like so: wxListItem newItem; newItem.SetId( count ); newItem.SetColumn( 0 ); newItem.
Read more >Problem in CTreeCtrl::InsertItem - MSDN - Microsoft
Hi everybody, I have a problem in MFC(VC++) and developing SDI application.When i call InsertItem function in onInitDialog of the dialog box
Read more >wxListCtrl: InsertItem Problem - wxWidgets Discussion Forum
Hello, i am a little bit confused. long wxListCtrl::InsertItem(long index, const wxString& label) This method returns a long var and needs a ...
Read more >ListView InsertItem problem (URGENT)
User-1176222693 posted. Hi, I have created a Master-Details Pages (GridView is parent and ListView is child). When i click the select button in...
Read more >Products Insert Problem - apex - Salesforce Stack Exchange
Below is my webservice i would like to insert products before quotes insert may i know how can i do this. while i...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

You need to define
insertItemmethod in thecontrolleroption http://js-grid.com/docs/#controller.@kjindal, in case of
resolvethe insertion will be completed and item will be added to the grid. In case ofrejectinsertion will be canceled.