PDA

View Full Version : Grid.plugin.RowEditing c# function call



nerradchoong
20 Mar 2012, 8:31 AM
Hi, am totally new to ExtJs and trying to understand the how to make a function call to c# under plugin.RowEditing. Is it possible?



xtype: 'gridpanel',
selType: 'rowmodel',
plugins: [
Ext.create('Ext.grid.plugin.RowEditing', {
clicksToEdit: 2,
listeners: {
'edit': function (editor, e) {
e.record.commit();
method: 'POST';
url: 'ControllerCenter/TestRowEditingCall';
//is there a way to make a call like above? how to make a function call to C# code
//I need to pass as well the e.record data as parameters
//editor.store.sync();
//var i = e.record.data['FNameDIndex'];
//var j = e.newValues['LNameDIndex'];
}
}
})
],
height: 200,
width: 400,
title: '',
border: false,
store: 'NameDataStore',
columns: [
{
header: 'FName',
sortable: true,
filterable: true,
dataIndex: 'FNameDIndex'
},
{
header: 'LName',
sortable: true,
filterable: true,
dataIndex: 'LNameDIndex'
}


I searched for some incomplete examples online, and all of them were updating the store first, but then? Am really lost, maybe someone could point me out a better way.

mitchellsimoens
20 Mar 2012, 9:39 AM
Is the function web accessible?

nerradchoong
20 Mar 2012, 9:43 AM
no, it's not

mitchellsimoens
20 Mar 2012, 9:50 AM
Then you cannot call it.

nerradchoong
20 Mar 2012, 10:04 AM
maybe i didn't fully get what you meant. The 'edit' event would be fired through the listener, but in order to save the data, I need to make a c# function call
1) under the listener
2) if you could tell me another way?

vietits
20 Mar 2012, 4:01 PM
Example of using Ajax request to call server side script:


listeners: {
'edit': function (editor, e) {
e.record.commit();
Ext.Ajax.request({
url : 'ControllerCenter/TestRowEditingCall',
method: 'POST',
params: {
... // get record values and put them here
},
...
});
}
}

nerradchoong
21 Mar 2012, 7:16 AM
thank you vietits, it works~~