PDA

View Full Version : Problem with EditorGridPanel (not Editable)



peido
19 May 2010, 12:51 AM
Hi, I have a problem with an editable grid. It works fine, but it not allow me to edit data.
I checked everything, but can not find the problem.
Thanks for your help.


var store = new Ext.data.JsonStore({
url: ‘paging2.php’,
root: ‘data’,
totalProperty: ‘total’, // <— total de registros a paginar
fields: ['fecha','titulo','comentario']
});

store.load();

var textField = new Ext.form.TextField();

var grid = new Ext.grid.EditorGridPanel({
store: store,
columns: [
new Ext.grid.RowNumberer(),
{header:'Fecha', dataIndex:'fecha',sortable: true},
{header:'Título', dataIndex:'titulo',sortable: true, editor:textField},
{header:'Comentario', dataIndex:'comentario',sortable: true, editor:textField}
],
border: false,
stripeRows: true
});

var win = new Ext.Window({
title: 'Back-End',
layout: 'fit',
width: 510,
height: 350,
items: grid
});

win.show();

Condor
19 May 2010, 1:14 AM
You need to create 2 separate editors, one for each column.

koenyn
19 May 2010, 2:45 AM
Hey,

as condor mentioned, you need a separate editor for each column that needs to be edited. Your code should actually change to something like this...


var grid = new Ext.grid.EditorGridPanel({
store : store,
columns : [
new Ext.grid.RowNumberer(),
{
header : 'Fecha',
dataIndex : 'fecha',
sortable : true
}, {
header : 'Título',
dataIndex : 'titulo',
sortable : true,
editor : new Ext.form.TextField() // creates a new textField for this column
}, {
header : 'Comentario',
dataIndex : 'comentario',
sortable : true,
editor : new Ext.form.TextField() // creates a new textField for this column
}
],
border : false,
stripeRows : true
});

peido
19 May 2010, 3:14 AM
I thank you for your help, but still not working. I'm thinking that may have something to do with my localhost.
I will continue trying.