【求助】关于exitjs editGrid,急等回复。
求救,求救。
Extjs editGrid(可编辑的表格) 一条记录有5个单元格,现在第五个单元格可以编辑,但是焦点一离开内容就有全没了,又变成编辑前的内容,而前面4个单元格就没事。为什么呀,谁知道呀。
谢谢大家了。很急。码字如下:
Ext.onReady(function(){
var record =Ext.data.Record.create([
{name:"WEATHERKEY", type:"string", mapping:"weatherKey"},
{name:"CITYC", type:"string", mapping:"cityc"},
{name:"DATECLASS", type:"string", mapping:"dateClass"},
{name:"WEATHER", type:"string", mapping:"weather"},
{name:"MINTEMP", type:"string", mapping:"mintemp"},
{name:"MAXTEMP", type:"string", mapping:"maxtemp"},
{name:"WIND", type:"string", mapping:"wind"},
{name:"PICTRUEA", type:"string", mapping:"pictrueA"},
{name:"PICTRUEP", type:"string", mapping:"pictrueP"}
]);
var cm = new Ext.grid.ColumnModel([
{header:"weatherKey", dataIndex:"WEATHERKEY", width:120, editor:new Ext.form.TextField()},
{header:"cityc", dataIndex:"CITYC", width:120, editor:new Ext.form.TextField()},
{header:"dateClass", dataIndex:"DATECLASS", width:120, editor:new Ext.form.TextField()},
{header:"weather", dataIndex:"WEATHER", width:120, editor:new Ext.form.TextField()},
{header:"minTemp", dateIndex:"MINTEMP", width:120, editor:new Ext.form.TextField()},
{header:"maxTemp", dateIndex:"MAXTEMP", width:120, editor:new Ext.form.TextField()},
{header:"wind", dateIndex:"WIND", width:120, editor:new Ext.form.TextField()},
{header:"pictrueA", dateIndex:"PICTRUEA", width:120, editor:new Ext.form.TextField()},
{header:"pictrueP", dateIndex:"PICTRUEP", width:120, editor:new Ext.form.TextField()}
]);
var reader = new Ext.data.JsonReader({root:"rows"},record);
var proxy=new Ext.data.HttpProxy({url:"manage/weather.do?method=getQingDaoWeather"});
store = new Ext.data.Store({
autoLoad:false,
proxy: proxy,
reader:reader
});
store.load();
var grid = new Ext.grid.EditorGridPanel({
store:store,
cm:cm,
autoWidth:true,
autoHeight:true,
renderTo:"weatherDiv",
autoEncode:true,
loadMask : true
});
});
------解决方案--------------------
var cm = new Ext.grid.ColumnModel([
{header:"weatherKey", dataIndex:"WEATHERKEY", width:120, editor:new Ext.form.TextField()},
{header:"cityc", dataIndex:"CITYC", width:120, editor:new Ext.form.TextField()},
{header:"dateClass", dataIndex:"DATECLASS", width:120, editor:new Ext.form.TextField()},
{header:"weather", dataIndex:"WEATHER", width:120, editor:new Ext.form.TextField()},
{header:"minTemp", dateIndex:"MINTEMP", width:120, editor:new Ext.form.TextField()},
{header:"maxTemp", dateIndex:"MAXTEMP", width:120, editor:new Ext.form.TextField()},
{header:"wind", dateIndex:"WIND", width:120, editor:new Ext.form.TextField()},
{header:"pictrueA", dateIndex:"PICTRUEA", width:120, editor:new Ext.form.TextField()},
{header:"pictrueP", dateIndex:"PICTRUEP", width:120, editor:new Ext.form.TextField()}
]);
看描红的地方,是dataIndex