so here's what I'm thinking...

Jun 7

ExtJS Grid roweditor - how to save your changes

It took a little while to figure out how to send my changes through an ajax request to my backend database page so I figured I’d post the code I used.

When you define your grid you then add RowEditing as a plugin. Add an edit listener to fire your function after the user clicks the “update” button. In the function I send a standard ajax request supplying the url and whatever kind of success function you want. The part that stumped me was because I couldn’t see any data being passed. I realized I had to supply the params option and give it the getChanges that have happened to the supplied record.

issuesgrid = {
	title: 'All Issues',
	plugins: [
		Ext.create('Ext.grid.plugin.RowEditing', {
			clicksToEdit: 2,
			listeners: {
				edit: function(e){
					Ext.Ajax.request({
						url: 'index.php/issue/update/' + e.record.get('reportID'),
						params: e.record.getChanges(),
						success: function(){}
					})
				}
			}
		})
	],
	columns: [
		{dataIndex: 'reportID', text: 'ID'},
...

Hope this saves someone some time.