PDA

View Full Version : Rownumberer and startEditing doesn't work together ? Is it a bug?



ma_nepali_keta
3 Aug 2010, 9:58 PM
Hi all
Recently just playing with ext js i found that the grid rownumberer and start editing doesn't work together. If rownumberer is removed from the column header, it just works perfect. Am i missing something here. Any suggestion will be appreciated.



Ext.onReady(function(){
var store = new Ext.data.JsonStore({
data: [
{firstname:"Fiqjieaf"},
{firstname:"Fiqjieaf"},
{firstname:"Fiqjieaf"}
],
fields: [
{
name: 'firstname'
}]
});
var grid = new Ext.grid.EditorGridPanel({
store: store,
renderTo: document.body,
width: 600,
height: 300,
sm: new Ext.grid.RowSelectionModel(),
title: 'Add Record',
frame: true,
columns: [
new Ext.grid.RowNumberer(),
{
id: 'common',
header: 'First Name',
dataIndex: 'firstname',
width: 220,
editor: new Ext.form.TextField()
}
],
clicksToEdit: 1,
tbar: [{
text: 'Add Record',
handler : function(){
var Plant = grid.getStore().recordType;
grid.stopEditing();
store.insert(0, new Plant({
firstname: 'First Name'
}));
grid.getView().refresh(true);
grid.getSelectionModel().selectRow(0);
grid.startEditing(0,0);
}
}
,{
text: 'Edit First Row',
handler: function(){
grid.startEditing(1,0);
}
}
]
});


}

);

Condor
4 Aug 2010, 12:34 AM
Column 0 will be the rownumberer, which can't be edited!

You need to start editing column 1, e.g. grid.startEditing(0, 1);

ma_nepali_keta
4 Aug 2010, 4:13 PM
Here it is ...I am so sorry for posting this stupid question without reading Api Docs.Solved Now...Thank you very much.