如何添加新数据并保存到ag-grid中的数据库?在https://ag-grid.com/javascript-grid-insert-remove/我只是获取插入和删除数据但不保存到数据库的信息。 我用聚合物来开发它。
这是添加数据的功能:
fAddBtn: function(){
var name = this.$.name.value;
var email = this.$.email.value;
var phone = this.$.phone.value;
var website = this.$.website.value;
var city = this.$.city.value;
var zipcode = this.$.zipcode.value;
var newList = {
'id' : '43',
'name' : name,
'email' : email,
'phone' : phone,
'website' : website,
'address' : {
'city' : city,
'zipcode' : zipcode
}
};
// this.set('rowData.0', newList);
this.gridOptions.api.addItems([newList]);
this.$.addDialog.close();
this.$.name.value = '';
this.$.email.value = '';
this.$.phone.value = '';
this.$.website.value = '';
this.$.city.value = '';
this.$.zipcode.value = '';
},