PDA

View Full Version : row editor+editor.on event



mayurid
14 Jul 2010, 5:38 AM
editor.on("afteredit",function(oGrid_event){
var e=oGrid_event.record;
Ext.Ajax.request({
url:'gl_account_details.php',
params: { task: "update",

field: oGrid_event.field,
row: oGrid_event.row,
value: oGrid_event.record.data.gl_name,

}
field: oGrid_event.field, row: oGrid_event.row---not able to fetch values of field and row

Condor
14 Jul 2010, 5:49 AM
You are confusing the RowEditor afteredit event with the EditorGridPanel afteredit event.

The RowEditor afteredit event has parameters: rowEditor, changes, record, rowIndex (where changes is an object with field/value pairs).

mayurid
14 Jul 2010, 5:58 AM
i want to fetch the row and field value how should i do it?

Condor
14 Jul 2010, 6:09 AM
A RowEditor edits the entire row, not a single field (or does your column model only contain a single editor?).

mayurid
14 Jul 2010, 8:33 PM
A RowEditor edits the entire row, not a single field (or does your column model only contain a single editor?).
my grid contains only one column i want to save changes i mean update so i need the field,row.. any other way to do this i am using php for backend

Condor
14 Jul 2010, 11:06 PM
I don't see the problem...

editor.on('afteredit', function(rowEditor, changes, record, rowIndex){
Ext.Ajax.request({
url:'gl_account_details.php',
params: {
task: 'update',
field: 'gl_name',
row: rowIndex,
value: changes['gl_name']
}
});
});

mayurid
15 Jul 2010, 9:10 PM
I don't see the problem...

editor.on('afteredit', function(rowEditor, changes, record, rowIndex){
Ext.Ajax.request({
url:'gl_account_details.php',
params: {
task: 'update',
field: 'gl_name',
row: rowIndex,
value: changes['gl_name']
}
});
});

i want to update a row,in row editor it just posts the value,field that is edited so how will i know which value i mean,which particular row is being edited and what does record contain

Condor
15 Jul 2010, 10:26 PM
You already know the rowIndex, so you can use that to get the current record:

var record = rowEditor.grid.getStore().getAt(rowIndex);

Condor
15 Jul 2010, 10:33 PM
Which parameters does the server require for an update?

mayurid
15 Jul 2010, 10:36 PM
Which parameters does the server require for an update?

i need 'id' to update the row,$query = "UPDATE gl_account SET $field = '$value' WHERE ???????????";// what should be the id? or any other param


editor.on('afteredit', function(rowEditor, changes, record, rowIndex){
var record = rowEditor.grid.getStore().getAt(rowIndex);
Ext.Ajax.request({
url:'gl_acc.php',
params: {
task: 'update',
field: 'gl_name',
row: rowIndex,
id:record, //not fetching anything
value: changes['gl_name']
}
});
});

Condor
16 Jul 2010, 12:10 AM
Use record.id or record.get('name-of-id-field') (depending on how your configured your store reader.

mayurid
16 Jul 2010, 1:04 AM
Use record.id or record.get('name-of-id-field') (depending on how your configured your store reader.
editor.on('afteredit', function(rowEditor, changes, record, rowIndex){
var record = rowEditor.grid.getStore().getAt(rowIndex);
Ext.Ajax.request({
url:'gl_account_details.php',
params: {
task: 'update',
field: 'gl_name',
row: rowIndex,
id:record.get('id'),// i got it lik this
value: changes['gl_name']
}
});
});


Thank You Very Very much........
Ur just Gr88

mayurid
16 Jul 2010, 1:07 AM
in the row editor example when we click to add the new row it shows the row but only when we edit it and make some changes it post the request..this is ok..i want that the user should be restricted after certain number of clicks.is it possible how???

please help

Condor
16 Jul 2010, 3:55 AM
'restrict after a certain number of clicks'? What do you mean by that?

mayurid
16 Jul 2010, 5:10 AM
'restrict after a certain number of clicks'? What do you mean by that?
in the row editor example you can see when we click the add row button the row appears with the update and cancel buttons,now for example if the user clicks the add row button for ten times then ten rows will appear,i want that after 5 continous clicks by user(without editing any row)in the 6 th click,no row should appear..

Condor
16 Jul 2010, 5:17 AM
Strange request... You will have to program something that only allows adding a record when there are less than 5 phantom=true records in the store.

mayurid
16 Jul 2010, 5:32 AM
record.phantom you mean?

mayurid
20 Jul 2010, 5:00 AM
@condor...how to count the clicks by using phantom?i don't know any example u can give please..
editor.on('afteredit', function(rowEditor, changes, record, rowIndex){
var record = rowEditor.grid.getStore().getAt(rowIndex);
var r1=record.phantom;

Ext.Ajax.request({
url:'gl_account_details.php',
params: {
task: 'update',
field: 'gl_name',
row: rowIndex,
id:record.get('id'),
value: changes['gl_name'],
success:function(){}

}
});
});

Condor
20 Jul 2010, 6:34 AM
In the beforeedit event of the RowEditor, count the number of records with phantom=true and return false if it is >= 5.

mayurid
21 Jul 2010, 4:48 AM
In the beforeedit event of the RowEditor, count the number of records with phantom=true and return false if it is >= 5.
@condor..
hi, i am implementing saki's record form plugin,in which i want a pop up window to appear to add a new row.i am not able to implement it...saki's code is not helping its some what complicated

Condor
21 Jul 2010, 4:52 AM
You'll probably get a better response if you post in Saki's original thread about the record form plugin.

mayurid
21 Jul 2010, 4:57 AM
k thank you...