Ext grid 如果在前台修改字段并显示

我的Grid 是没有分页的,左右数据在一页里显示。
我想改变grid里面某一行的值,并且实时显示,请文该怎么做
例如:
Ext.onReady(function(){

// NOTE: This is an example showing simple state management. During development,
// it is generally best to disable state management as dynamically-generated ids
// can change across page loads, leading to unpredictable results.  The developer
// should ensure that stable state ids are set for stateful components in real apps.    
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var myData = [
    ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],
    ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],
    ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],
    ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],
    ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],
    ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],
    ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],
    ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],
    ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],
    ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],
    ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],
    ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],
    ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],
    ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],
    ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],
    ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],
    ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],
    ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],
    ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],
    ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],
    ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],
    ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],
    ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],
    ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],
    ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],
    ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],
    ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],
    ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'],            
    ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']
];

// example of custom renderer function
function change(val){
    if(val > 0){
        return '<span style="color:green;">' + val + '</span>';
    }else if(val < 0){
        return '<span style="color:red;">' + val + '</span>';
    }
    return val;
}

// example of custom renderer function
function pctChange(val){
    if(val > 0){
        return '<span style="color:green;">' + val + '%</span>';
    }else if(val < 0){
        return '<span style="color:red;">' + val + '%</span>';
    }
    return val;
}

// create the data store
var store = new Ext.data.ArrayStore({
    fields: [
       {name: 'company'},
       {name: 'price', type: 'float'},
       {name: 'change', type: 'float'},
       {name: 'pctChange', type: 'float'},
       {name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'}
    ]
});
store.loadData(myData);

// create the Grid
var grid = new Ext.grid.GridPanel({
    store: store,
    columns: [
        {id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company'},
        {header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
        {header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change'},
        {header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange'},
        {header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'}
    ],
    stripeRows: true,
    autoExpandColumn: 'company',
    height:350,
    width:600,
    title:'Array Grid'
});
grid.render('grid-example');

});

我想修改 里面某列的值 请问怎么修改

3个回答

[code="js"]
//i为行号
grid.store.getAt(i).set('company','华为')
[/code]

其实你可以使用可编辑的Grid组件。
官方里面已经有例子:
列编辑:[url]http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html[/url]
整行编辑:[url]http://www.extjs.com/deploy/dev/examples/grid/row-editor.html[/url]

例子
{id:'company',
header: "Company",
width: 160,
sortable: true,
dataIndex: 'company',
renderer:function(v){
return "华为";

}
  } 

加个 renderer就行了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Ext grid 如果在前台修改字段并显示
我的Grid 是没有分页的,左右数据在一页里显示。rn我想改变grid里面某一行的值,并且实时显示,请文该怎么做rn例如:rnExt.onReady(function()rnrn // NOTE: This is an example showing simple state management. During development,rn // it is generally best to disable state management as dynamically-generated idsrn // can change across page loads, leading to unpredictable results. The developerrn // should ensure that stable state ids are set for stateful components in real apps. rn Ext.state.Manager.setProvider(new Ext.state.CookieProvider());rnrn var myData = [rn ['3m Co',71.72,0.02,0.03,'9/1 12:00am'],rn ['Alcoa Inc',29.01,0.42,1.47,'9/1 12:00am'],rn ['Altria Group Inc',83.81,0.28,0.34,'9/1 12:00am'],rn ['American Express Company',52.55,0.01,0.02,'9/1 12:00am'],rn ['American International Group, Inc.',64.13,0.31,0.49,'9/1 12:00am'],rn ['AT&T Inc.',31.61,-0.48,-1.54,'9/1 12:00am'],rn ['Boeing Co.',75.43,0.53,0.71,'9/1 12:00am'],rn ['Caterpillar Inc.',67.27,0.92,1.39,'9/1 12:00am'],rn ['Citigroup, Inc.',49.37,0.02,0.04,'9/1 12:00am'],rn ['E.I. du Pont de Nemours and Company',40.48,0.51,1.28,'9/1 12:00am'],rn ['Exxon Mobil Corp',68.1,-0.43,-0.64,'9/1 12:00am'],rn ['General Electric Company',34.14,-0.08,-0.23,'9/1 12:00am'],rn ['General Motors Corporation',30.27,1.09,3.74,'9/1 12:00am'],rn ['Hewlett-Packard Co.',36.53,-0.03,-0.08,'9/1 12:00am'],rn ['Honeywell Intl Inc',38.77,0.05,0.13,'9/1 12:00am'],rn ['Intel Corporation',19.88,0.31,1.58,'9/1 12:00am'],rn ['International Business Machines',81.41,0.44,0.54,'9/1 12:00am'],rn ['Johnson & Johnson',64.72,0.06,0.09,'9/1 12:00am'],rn ['JP Morgan & Chase & Co',45.73,0.07,0.15,'9/1 12:00am'],rn ['McDonald\'s Corporation',36.76,0.86,2.40,'9/1 12:00am'],rn ['Merck & Co., Inc.',40.96,0.41,1.01,'9/1 12:00am'],rn ['Microsoft Corporation',25.84,0.14,0.54,'9/1 12:00am'],rn ['Pfizer Inc',27.96,0.4,1.45,'9/1 12:00am'],rn ['The Coca-Cola Company',45.07,0.26,0.58,'9/1 12:00am'],rn ['The Home Depot, Inc.',34.64,0.35,1.02,'9/1 12:00am'],rn ['The Procter & Gamble Company',61.91,0.01,0.02,'9/1 12:00am'],rn ['United Technologies Corporation',63.26,0.55,0.88,'9/1 12:00am'],rn ['Verizon Communications',35.57,0.39,1.11,'9/1 12:00am'], rn ['Wal-Mart Stores, Inc.',45.45,0.73,1.63,'9/1 12:00am']rn ];rnrn // example of custom renderer functionrn function change(val)rn if(val > 0)rn return '' + val + '';rn else if(val < 0)rn return '' + val + '';rn rn return val;rn rnrn // example of custom renderer functionrn function pctChange(val)rn if(val > 0)rn return '' + val + '%';rn else if(val < 0)rn return '' + val + '%';rn rn return val;rn rnrn // create the data storern var store = new Ext.data.ArrayStore(rn fields: [rn name: 'company',rn name: 'price', type: 'float',rn name: 'change', type: 'float',rn name: 'pctChange', type: 'float',rn name: 'lastChange', type: 'date', dateFormat: 'n/j h:ia'rn ]rn );rn store.loadData(myData);rnrn // create the Gridrn var grid = new Ext.grid.GridPanel(rn store: store,rn columns: [rn id:'company',header: "Company", width: 160, sortable: true, dataIndex: 'company',rn header: "Price", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price',rn header: "Change", width: 75, sortable: true, renderer: change, dataIndex: 'change',rn header: "% Change", width: 75, sortable: true, renderer: pctChange, dataIndex: 'pctChange',rn header: "Last Updated", width: 85, sortable: true, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'rn ],rn stripeRows: true,rn autoExpandColumn: 'company',rn height:350,rn width:600,rn title:'Array Grid'rn );rn grid.render('grid-example');rn);rnrn我想修改 里面某列的值 请问怎么修改
EXT grid 不显示
rnrn rn Examplern rn rn rnrn rn rn rn rnrn rn tablern rnrn
ext grid 显示数据
LearningExtJS 第五章节的翻译
ext grid显示json数据
rnrnrnrnrnrnrn  
Ext Grid 表头显示问题
出现问题了,当 Grid div 放在 table 布局下的话 文档的docType采用html默认的doctype(不声明即可),如果采用xhtml或html4 strict则Ext会出现很多问题。 ie6 我碰到了!!!(IE7.0 firefox 没问题) 表头没了,见下图:     ...
ext grid 数据不显示
ext grid 数据不显示解决方案: 1)首先看grid的数据是否获取到了; 2)若数据获取到了且数据格式正确,再看前端Ext.grid.GridPanel是否写的正确,store和列模型是否相对应,如: [code=&quot;js&quot;]new Ext.grid.ColumnModel([ new Ext.grid.CheckboxSelectionModel(), {heade...
Ext Grid 小数显示问题
Ext Grid 浮点类型的字段.只能显示2位小数. 如何能让其显示3位小数. rn 如果是可以编辑的 Grid 输入完数据如何也保持显示3位小数
Ext之控制grid的下边缘显示
[color=green]需要将 margins写成 margins:'0 0 0 0'的形式。[/color] 不要写成 margins:0 的形式。 [code=&quot;javascript&quot;] //viewport var view=new Ext.Viewport({ layout:'border', border:false,...
Ext grid 的ToolTip显示不了
onRender: function() rn Ext.grid.GridPanel.prototype.onRender.apply(this, arguments);rn this.addEvents("beforetooltipshow");rn this.tooltip = new Ext.ToolTip(rn renderTo: Ext.getBody(),rn target: this.view.mainBody,rn listeners: rn beforeshow: function(qt) rn var v = this.getView();rn var row = v.findRowIndex(qt.baseTarget);rn var cell = v.findCellIndex(qt.baseTarget);rn rn //if(cell==1)rn if(cell)rn this.fireEvent("beforetooltipshow", this, row, cell);rn rn //rn ,rn scope: thisrn rn );rn ,rn listeners: rn render: function(g) rn g.on("beforetooltipshow", function(grid, row, col) rn if(grid.getView()&&grid.getView().getCell(row, col)&&grid.getView().getCell(row, col).innerHTML)rn grid.tooltip.body.update(grid.getView().getCell(row, col).innerHTML.trim());rn rn );rn rn ,rnrnrnrnrnvar row = v.findRowIndex(qt.baseTarget);rnvar cell = v.findCellIndex(qt.baseTarget);rn不知道为什么row和cell取不到
EXT grid 列名不显示
很郁闷grid的列名就是不显示!!!当我把页面上的EXT的样式去掉就能显示了rn去掉这句代码 后gird的列名就可以显示,但是EXT的样式都没了!!!rn求求大侠帮我解决这个问题!!
ext grid不显示数据
我用的是struts2和ext3.0rn我在自己的action里调用rnoutJson(stuList);rn这个方法是我从网上找的例子的工具类继承来的rn工具类代码如下rn[code=Java]rnpackage com.jju.psytest.action;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnimport java.io.Serializable;rnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport net.sf.json.JSONArray;rnimport net.sf.json.JSONObject;rnrnimport org.apache.struts2.ServletActionContext;rnrnimport com.opensymphony.xwork2.ActionSupport;rnrn/**rn * rn * yulinlincom@gmail.comrn * @author linlin yurn * @version 1.0rn */rnpublic class BaseAction extends ActionSupport implements Serializable rn rn public HttpServletRequest getRequest() rn return ServletActionContext.getRequest();rn rnrn public HttpServletResponse getResponse() rn return ServletActionContext.getResponse();rn rnrn public void outJsonString(String str) rn getResponse().setContentType("text/javascript;charset=UTF-8");rn rn System.out.println(str);//测试代码rn outString(str);rn rnrn public void outJson(Object obj) rn outJsonString(JSONObject.fromObject(obj).toString());rn rnrn public void outJsonArray(Object array) rn outJsonArray(JSONArray.fromObject(array).toString());rn rn //最后输出的方法rn public void outString(String str) rn try rn rn PrintWriter out =getResponse().getWriter();rn out.write(str);rn catch (IOException e) rn rn rnrn public void outXMLString(String xmlStr) rn getResponse().setContentType("application/xml;charset=UTF-8");rn outString(xmlStr);rn rnrnrnrn[/code]rnrn后台可以把json数据打印出来rn"list":["id":"1","name":"name1","id":"2","name":"name2","id":"3","name":"name3","id":"4","name":"name4"],"message":"","success":false,"totalSize":4rn可前台可以显示表格,但是表格内容为空rn前台ext代码为rn[code=JScript]rnExt.onReady(function()rnrn var cm = new Ext.grid.ColumnModel([rn rn header: '编号 ',rn dataIndex: 'id',rn width: 30rn , rn rn header: '名字 ',rn dataIndex: 'name',rn width: 50rn rn ]);rn cm.defaultSortable = true;rn rnrn rn rn var ds = new Ext.data.Store(rn proxy: new Ext.data.HttpProxy(rn url:'admin/student_list.action',rn method:'post'rn ),rn reader: new Ext.data.JsonReader(rn rn totalProperty : 'totalSize',rn id : 'id',rn remoteSort: true,rn root:'list',rn fields:[rn name:'id',type:'string',rn name:'name',type:'string'rn ]rn )rn );rn rn ds.load();rn rn var grid = new Ext.grid.GridPanel(rn margins: '5 5 5 5 ',rn renderTo: 'grid',rn width: 600,rn height: 500, rn store: ds,rn cm: cm,rn viewConfig: rn forceFit: truern rn );rn rn var viewport = new Ext.Viewport( rn layout : 'border',rn items : [ grid ]rn );rn);rn[/code]rn
ext grid显示查出来的字段
公司有个这样的需求:rnSQL:select id as 编号,name as 名字,age as 年龄 from Users;rnrn然后在ext js 里面的grid,要显示rn编号 名字 年龄,grid的column不能写死,需要根据查出来的字段变动,假如上述SQL得到的编号,名字,年龄,rn如果SQL改成:select name as 昵称,remark as 备注 from Users;rn则grid中的column也要是昵称,备注.rn即grid中的column名字从SQL中查出的字段获得,而不时写死.rn请问怎么实现...rnrn急!!!
json数据到ext前台显示的问题
后台构造了一组json数据,如下rn"Number":"20090201","Name":"aaa","BeginDate":"\/Date(1233504000000+0800) \/","LastDate":"\/Date(1233936000000+0800)\/","Holiday":"婚假","Days":4,"State":1,"Job":"pg","Team":"b","Dept":"1"rn"Number":"20090202","Name":" lqc","BeginDate":"\/Date(1233504000000+0800)\/","LastDate":" \/Date(1233763200000+0800)\/","Holiday":"产假","Days":2,"State":1,"Job":"pg","Team":"b","Dept":"1"rn"Number":"20090204","Name":"cx","BeginDate":"\/Date(1235750400000+0800)\/","LastDate":" \/Date(-639129600000+0800)\/","Holiday":"丧假","Days":366,"State":3,"Job":"pg","Team":"a","Dept":"2"rn"Number":"20090204","Name":" cx","BeginDate":"\/Date(-749376000000+0800)\/","LastDate":" \/Date(-236505600000+0800)\/","Holiday":"探亲假","Days":366,"State":3,"Job":"pg","Team":"a","Dept":"2"rn"Number":"20090202","Name":"lqc","BeginDate":"\/Date(1233504000000+0800)\/","LastDate":" \/Date(1233763200000+0800)\/","Holiday":"产假","Days":2,"State":1,"Job":"pg","Team":"b","Dept":"1"rn怎样把数据放到ext的Store里面去呢(一组数据都要放进去 而且数据条数未知 可以没有数据)
Ext grid
如何获得grid的行数rn如何获得某个单元格的值rn如何让可编辑grid的单元格如果没有输入值,这个单元格就不会失去焦点rn可编辑的grid的单元格如果被编辑后,就会打上标记,有什么方法可以随意控制不要填上这个标记
ext grid
grid 中有几个字段,起始日期(startDate),设置日期(putDate),期限(deadline),备注(remark)rnrn如果 putDate 在 startDate 和 deadline 之间 备注显示 有效rn rn 否则 备注显示无效rnrn
如果在grid中自动编号?
我想在DBGRID中产生一个从1开始自动增加的序号列!rnrn4点之前结贴!
ext grid 删除行并删除数据库
我现在编了一个grid,从数据库取出信息并显示出来,我现在添加了一个删除按钮,能够删除grid的数据,但数据库的数据不太会,下面是我写的代码[code=Java]handler:function()rn var selModel = grid.getSelectionModel();rn rn if (selModel.hasSelection()) rn Ext.Msg.confirm("警告", "确定要删除吗?", function(button) rn if (button == "yes") rn var selectedRows = grid.selModel.selections.items;rn var selectedKeys = grid.selModel.selections.keys;rn var encoded_keys = Ext.encode(selectedKeys);//rn rn var selections = selModel.getSelections();rn Ext.each(selections, function(item) rn ds.remove(item);rn ds.removed.push(item);rn // var ids = new Array();rn /*for (var i = 0, len = selections.length; i < len; i++) rn ids[ids.length] = selections[i].id;rn */rn // Ext.Msg.alert('警告',ids); rn function successFn(response,options)rn rn Ext.MessageBox.alert(' 提示','你删除的数据ID为'+encoded_keys);rn rn function failureFn(response,options)rn Ext.MessageBox.alert('提示','数据删除失败!'); rn rn rn Ext.Ajax.request(rn url : 'person_show.jsp',rn method : 'post',rn params : data:encoded_keys//,rn // success :successFn, rn // failure :failureFnrn /* callback : function(options, success, response) rn var responseArray = Ext.util.JSON.decode(response.responseText);rn if (responseArray.success == true) rn Ext.MessageBox.hide();rn Ext.MessageBox.alert("success", "delete option success");rn dataStore.reload();rn else rn Ext.MessageBox.hide();rn Ext.MessageBox.alert("失败,请重试", responseArray.message);rn rn ,rn failure : function(response, options) rn Ext.MessageBox.hide();rn ReturnValue = Ext.MessageBox.alert("警告", "出现错误,请与管理员联系");rn */rn );rn Ext.MessageBox.alert('提示',encoded_keys); rn rn rn );rn rnrn );rn rn else rn Ext.Msg.alert("错误", "没有任何行被选中,无法进行删除操作!");rn rn [/code]rn我现在想知道,在person_show.jsp里怎么接收信息啊,是request吗,我看网上都是这么写的,但是穿的值是["ext-record-22","ext-record-12","ext-record-13","ext-record-14"]rn,如果用request获取改怎么处理啊,我知道如果传递的值是数据库表的值,那么只需要删除语句就行,但这个我就不懂了,希望大家帮忙
Ext中的grid的数据显示问题
从服务端获取到数据后,grid的该列值是0,或1,或-1;rn在ext展现时,需要将grid的该列展现分别对应为“审核中”,“通过”,“未通过”,ext应该如何实现呢?rn希望有此经验的GS们帮忙。。。。谢谢!
ext 条件查询grid显示的问题(菜鸟问题)~
提交一个表单,包括combo,datefield,textfield,用grid显示,不知道提交的buttons怎么写,初学者,没找到这方面的资料,一下代码怎么能提交到grid读取?rn[code=JScript]rnvar form = new Ext.form.FormPanel(rn title: '条件查询',rn region: 'east',rn frame: true,rn width: 300,rn autoHeight: true,rn labelAlign: 'right',rn labelWidth: 60,rn defaultType: 'textfield',rn defaults: rn width: 200,rn allowBlank: falsern ,rn items: [rn rn xtype: 'hidden',rn name: 'id'rn ,rn rn fieldLabel: '名',rn name: 'gameName',rn xtype: 'combo',rn store: new Ext.data.SimpleStore(rn fields: ['text'],rn data: [['a'],['b'],['c']]rn ),rn emptyText: '请选择',rn mode: 'local',rn triggerAction: 'all',rn valueField: 'text',rn displayField: 'text',rn readOnly: truern rn ,rn fieldLabel: 'name2',rn name: 'serverName',rn ,rn name:'begin',rn xtype:'datefield', rn //name='publishDate',rn emptyText:'请选择',rn format :'Y-m-d',rn minValue :'01/01/2007',rn maxValue:new Date(),rn readOnly: truern ,rn name:'finish',rn xtype:'datefield', rn emptyText:'请选择',rn format :'Y-m-d',rn minValue :'01/01/2007',rn maxValue:new Date(),rn readOnly: truern ,rn rn name: 'gameType',rn xtype: 'combo',rn store: new Ext.data.SimpleStore(rn fields: ['text'],rn data: [['1'],['2'],['3'],['4']]rn ),rn emptyText: '请选择',rn mode: 'local',rn triggerAction: 'all',rn valueField: 'text',rn displayField: 'text',rn readOnly: truern rn ],rn buttons: [rn text: '提交',rn handler: function() rn if (!form.getForm().isValid()) rn return;rn rnrn form.getForm().submit(rn url: './jsp/query.jsp',rn success: function(f, action) rn if (action.result.success) rn Ext.Msg.alert('消息', action.result.msg, function() rn grid.getStore().reload();rn form.getForm().reset();rn form.buttons[0].setText('提交');rn );rn rn ,rn failure: function() rn Ext.Msg.alert('错误', "提交失败");rn rn );rn rn;rn rn ,rn text: '清空',rn handler: function() rn form.getForm().reset();rn form.buttons[0].setText('提交');rn rn ]rn );rn[/code]
ext grid中小数显示的问题
比如小数0.5会显示为.5,这不是我想要的结果,1.5就会正常显示,请问怎么办?最好不修改源代码,我用是ext2.0
ext grid CheckboxSelectionModel动态控制checkbox显示
如题,我想实现的是,一条记录有多个分录,但只有主记录才有checkboxrn例如:rn口 序号 凭证 摘要rn口 1 1 服饰rn 2 小衫rn口 3 2 鞋帽rn 4 皮鞋rn 5 凉鞋rn口 5 3 小百rn口 6 4 物流rn这是六条记录,在加载数据时根据凭证号来判断是否有checkbox选项
vs2012开发Ext,Grid显示空行问题
如题,vs2012开发Ext,后台数据库数据调用成功,并已经转化为JSON格式,但是Grid只显示空行,没有具体数据显示,求帮忙解答[img=https://img-bbs.csdn.net/upload/201305/03/1367512011_26450.png][/img][code=javascript]var EquInfoStore;rnEquInfoManage = function (node) rnrn //分页每页显示数量 rn var pageSize = 12;rn //指定列参数rn var fields = ["equid", "equname", "equteachername", "equdate", "equtime", "equaddress"];rn EquInfoStore = new Ext.data.Store(rnrn proxy: new Ext.data.HttpProxy(rn rn url: "DATA/EquInfo/EquInfo.aspx",rn method: "POST"rn ),rn reader: new Ext.data.JsonReader(rn rn fields: fields,rn root: "data",rn id: "equid",rn totalProperty: "totalCount"rn )rn );rn //加载参数rn EquInfoStore.load( params: start: 0, limit: pageSize );rnrn //--------------------------------------------------列选择模式rn var sm = new Ext.grid.CheckboxSelectionModel(rn dataIndex: "equid"rn );rn //--------------------------------------------------列头rn var cm = new Ext.grid.ColumnModel([rn sm, rn header: "课程ID",rn dataIndex: "equid",rn tooltip: "课程唯一标识",rn //可以进行排序rn sortable: truern , rn header: "课程名称",rn tooltip: "课程名称",rn width: 130,rn dataIndex: "equname",rn sortable: true,rn renderer: function (value) rn return "" + value + "";rn rn , rn header: "指导老师",rn tooltip: "老师姓名",rn //dataIndex: "guestname",equteachernamern dataIndex: "equteachername",rn sortable: true,rn renderer: function (value) rn return "" + value + "";rn rn , rnrn header: "实验日期",rn tooltip: "实验日期",rn //dataIndex: "guestname",equteachernamern dataIndex: "equdate",rn sortable: true,rn renderer: function (value) rn return "" + value + "";rn rn , rn header: "实验时间",rn tooltip: "实验时间",rn dataIndex: "equtime",rn sortable: true,rn renderer: function (value) rn return "" + value + "";rn rnrn , rn header: "实验地点",rn width: 220,rn tooltip: "实验地点",rn dataIndex: "equaddress",rn //可以进行排序rn sortable: truern ]);rnrnrn //----------------------------------------------------定义gridrn var EquInfogrid = new Ext.grid.GridPanel(rn id: "EquInfogrid",rn store: EquInfoStore,rn sm: sm,rn cm: cm,rn loadMask: true,rn //超过长度带自动滚动条rn autoScroll: true,rn border: false,rn viewConfig: rn columnsText: "显示/隐藏列",rn sortAscText: "正序排列",rn sortDescText: "倒序排列",rn forceFit: truern rn rn );rnrn //传入icon样式rn GridMain(node, EquInfogrid, "guesticon");rn[/code]
ext时间为空grid就不显示了?
在grid中,时间为空就不显示了。怎么能让有空的也显示呢?rn[code=Java]rnrnvar StudentRecord = Ext.data.Record.create([rn name: 'id', type: 'int',rn name: 'subject', type: 'string',rn name: 'signDate', type: 'date',dateFormat : 'time' ,mapping : 'signDate.time',rn name: 'state', type: 'string',rn name: 'addDate', type: 'date',dateFormat : 'time' ,mapping : 'addDate.time' rn]);rnrnrnvar store = new Ext.data.Store(rn proxy: new Ext.data.HttpProxy(rn url: 'doContract.do?method=_getList' rn ),rn reader: new Ext.data.JsonReader(rn totalProperty: 'total',rn root: 'data'rn ,StudentRecord),rn rn remoteSort: falsern);rnrnstore.load(rn params:start:0,limit:18,rn callback:function(r,option,success)rn rn if(success==false)rn rn Ext.MessageBox.alert('错误', '你权限不够或服务器异常.' );rn rn rn rn );rn var sm = new Ext.grid.CheckboxSelectionModel();//创建复选框rnrnvar columns = new Ext.grid.ColumnModel([rn sm,//创建复选框rn header: 'ID', dataIndex: 'id',sortable: true,rn header: '合同主题', dataIndex: 'subject',sortable: true,rn header: '签定日期', dataIndex: 'signDate',sortable: true,renderer :Ext.util.Format.dateRenderer('Y-m-d H:i:s'),rn header: '合同状态', dataIndex: 'state',sortable: true ,rn header: '添加时间', dataIndex: 'addDate',sortable: true,renderer :Ext.util.Format.dateRenderer('Y-m-d H:i:s') rn rn]);rnrnrn[/code]
Ext Grid不能正确显示标题栏
以下是代码rn[code=JScript]Ext.onReady(function()rn rn Ext.QuickTips.init();rn rn var info = Ext.data.Record.create([rn name: 'id', type: 'int',rn name: 'name', type: 'string',rn name: 'pid', type: 'int',rn name: 'position', type: 'int',rn name: 'image', type: 'string',rn name: 'innerhtml', type: 'string',rn name: 'listDeep', type: 'int',rn name: 'actionName', type: 'string',rn name: 'actionIndex', type: 'string',rn name: 'sid', type: 'int'rn ]);rn rn var store = new Ext.data.Store(rn proxy: new Ext.data.DWRProxy(SystemController.GetModulesList, true),rn reader: new Ext.data.ListRangeReader(rn totalProperty: 'totalSize',rn root: 'data',rn id: 'id'rn , info),rn remoteSort: truern );rn rn rn var sm = new Ext.grid.CheckboxSelectionModel();rn rn var cm = new Ext.grid.ColumnModel([sm,rn header:'编号',dataIndex:'id',rn header:'名称',dataIndex:'name',rn header:'父编号',dataIndex:'pid',rn header:'位置',dataIndex:'position',rn header:'图片',dataIndex:'image',rn header:'html',dataIndex:'innerhtml',rn header:'深度',dataIndex:'listDeep',rn header:'动作名称',dataIndex:'actionName',rn header:'动作索引',dataIndex:'actionIndex', rn header:'Sid',dataIndex:'sid'rn ]);rn rn var tbar=new Ext.Toolbar([rn rn text : '添加',rn tooltip : '添加一条模块信息',rn iconCls : 'add',rn onClick : function() rn alert('添加');rn rn , '-', rn text : '修改',rn tooltip : '修改选中模块信息',rn iconCls : 'option',rn onClick : function() rn alert('修改');rn rn , '-', rn text : '删除',rn tooltip : '删除选中的模块信息',rn iconCls : 'remove',rn onClick : function() rn alert('删除');rn rn ]);rn rn var bbar=new Ext.PagingToolbar(rn pageSize : 20,rn store : store,rn displayInfo : true,rn displayMsg : '显示第 0 条到 1 条记录,一共 2 条',rn emptyMsg : "没有记录" rn );rn rn rnrn var grid = new Ext.grid.GridPanel(rn renderTo: document.body,rn autoHeight: true,rn store: store,rn cm: cm,rn sm:sm,rn tbar:tbar,rn bbar: bbar,rn width : 815,rn stripeRows : true,rn viewConfig : rn forceFit : truern ,rn autoHeight : true,rn title : '人员信息列表',rn iconCls : 'icon-grid'rn );rn rn rn store.load(params:start:0,limit:20);rn);[/code]rnrn上面代码可以正确显示,但声称的Grid不能显示标题栏,偶尔在点击菜单栏时能显示一下标题栏,不知道哪里出了问题,请高手帮忙帮忙
ext 的grid不在页面上显示
rnExt.onReady(function() rn var viewport = new Ext.Viewport(rn layout : "border",rn items : [rn region : 'north',rn contentEl : 'head'rn , rn region : 'center',rn html : 'grid'rn , rn region : 'east',rn html : 'form'rn , rn region : 'south',rn contentEl : 'foot'rn ]rn );rn var sexRenderer = function(value) rn if (value == 1) rn return "男"; // 红色字体rn else if (value == 2) rn return "女"; // 绿色字体rn rn ;rn var StudentsRecord = Ext.data.Record.create([rn name : 'id',rn type : 'int'rn , rn name : 'code',rn type : 'string'rn , rn name : 'name',rn type : 'string'rn , rn name : 'sex',rn type : 'int'rn , rn name : 'age',rn type : 'int'rn , rn name : 'political',rn type : 'string'rn , rn name : 'origin',rn type : 'string'rn , rn name : 'professional',rn type : 'string'rn ]);rn var store = new Ext.data.Store(rn proxy : new Ext.data.HttpProxy(rn url : 'list.jsp'rn ),rn reader : new Ext.data.JsonReader(rn totalProperty : 'totalCount',rn root : 'result'rn , StudentsRecord),rn remoteSort : truern );rn store.load(rn params : rn start : 0,rn limit : 15rn rn );rn rn var columns = new Ext.grid.ColumnModel([rn header : '学号',rn dataIndex : 'code'rn , rn header : '姓名',rn dataIndex : 'name'rn , rn header : '性别',rn dataIndex : 'sex',rn renderer : sexRendererrn , rn header : '年龄',rn dataIndex : 'age'rn , rn header : '政治面貌',rn dataIndex : 'political'rn , rn header : '籍贯',rn dataIndex : 'origin'rn , rn header : '所属系',rn dataIndex : 'professional'rn ]);rn columns.defaultSortable = true;rn // grid startrn var grid = new Ext.grid.GridPanel(rn title : '学生信息列表',rn region:'center',rn loadMask : true,rn store : store,rn cm : columns,rn sm : new Ext.grid.RowSelectionModel(rn singleSelect : truern ),rn viewConfig : rn forceFit : truern ,rn bbar : new Ext.PagingToolbar(rn pageSize : 15,rn store : store,rn displayInfo : truern )rn );
为什么EXT grid不能显示数据?
![图片说明](https://img-ask.csdn.net/upload/201603/16/1458114978_600658.png)n![图片说明](https://img-ask.csdn.net/upload/201603/16/1458114990_605801.png)n![图片说明](https://img-ask.csdn.net/upload/201603/16/1458115007_687304.png)nn求解,为什么grid里面没有数据显示?各位大神帮帮忙
EXT的Grid没有显示横向的滚动条
主要的代码:、rnrn  rn 不显示横向滚动条:rn 如图:rn rn  rn  rn 。。。。求解释求真相!
Ext Grid 列内容显示处理
如果在Ext Grid里面Store从后台加载的数据还不是最终要显示的列内容,那么我们需要对该列的内容作特殊处理。   处理效果可以是增加显示内容,增加tip提示,增加操作列等。处理方法如下:     var configColumns = new Ext.grid.ColumnModel({ defaults : { sortable : true ...
关于 EXT JS grid不显示header
下面的代码,是我照着大侠写过的EXT JS改的,为什么grid不显示header的内容?也就是grid的数据列不显示“节目名称”等列名?rnrn[code=JScript]rnrnrnrn rn rn rnrnrn rnrn rn rn rnrnrn[/code]
一个ext的grid分页栏显示不出来
//=======================这个是ext代码=========================rn[code=JScript]rn rn[/code]rnrn//=======================这个是后台 java=========================rn[code=Java]rnpublic static String index(Integer start, Integer limit)rn rn List products = Product.findAll();rn String root ="root:[";rn String totalProprerty = "totalProperty : 100";rn String ds = "";rn for (Product product : products) rn root += "id:'" + product.getId() + "', name:'" + product.getName() +"',";rn rn //删除最后逗号 并加上中括号rn root = root.substring(0, root.length() - 1) + "]";rn rn ds = "" + totalProprerty + "," + root + "";rn rn Logger.debug(ds);rn rn return ds;rn //输出时这样的 totalProperty : 100,root:[id:'17', name:'砖石手表',id:'18', name:'釜山手表']rn rn[/code]rnrn结果效果变成这样了rn[img=http://hiphotos.baidu.com/%D4%DE%D6%FA%C4%E3%CE%A2%D0%A6me/pic/item/63ca183b0f90989bb311c7b2.jpg][/img]
在前台的grid显示如何省略超出的字。
想达到这样的效果rn COLUMN HEADER A | COLUMN HEADER B|rn AAAAAAAAAAAAAAAA| BBBBBBB|rnrn当出现20个A的话那么A列自然放不下,于是就把它截掉,我是通过设置overflow:hidden实现的。rn现在可以顺利的把A截掉。rn但当我设置B列的时候,居然设置为右对齐的B列也被截掉了半个字符。请问有人知道原因么。
SSH框架+Ext技术做前台显示。。。
该资源采用SSH框架以及Ext技术做前台显示,不错的哦。。。
Ext grid 滚动条自动滚动
grid.getView().scroller.dom.scrollTop=grid.getView().scroller.dom.scrollHeight - grid.getView().scroller.dom.offsetHeight;
有用的ext grid 例子
有用的ext grid 例子 收藏 &amp;lt;script type=&quot;text/javascript&quot;&amp;gt; document.body.oncopy = function() { if (window.clipboardData) { setTi...
Ext grid filter
官方例子 Ext grid filter
Ext grid 导出Excel
NULL 博文链接:https://zhaolicric.iteye.com/blog/970655
Ext 动态生成Grid
var grid = this.lookupReference('psMarketInfoCollectListGrid');//psMarketInfoCollectListGrid:grid ID                  var store = Ext.create('Ext.data.Store', {             storeId: 'simpsonsStore'
Ext grid合并单元格
1.js代码MyGridView=Ext.extend(Ext.grid.GridView,{   renderHeaders : function(){       var cm = this.cm, ts = this.templates;       var ct = ts.hcell,ct2=ts.mhcell;              var cb = [], sb = [], p =...
Ext的部分Grid属性设置
forceFit:是否强制列调整宽度使得不出现水平滚动条,默认是false。enableRowBody:为true的时候允许每行增加一个tr元素用来扩展数据行。showPreview:自定义的bool类型的属性,用来在代码中控制是否显示预览。getRowClass:这是一个方法,用来改写行的css样式,它有四个参数,第一个是代表该行数据的Record对象,第二个是行的索引,第三个就是enableR...
Ext 动态添加grid 列数
在做报表的时候,需要将grid的列数做成活的,列数有数据库里的字段确定,这据需要将grid的列数做成动态的,经过多次实验已成,如下: 后台返回的json: {'action':true,'message':'error!','data':[ {'number':'1','text1': '3','info1': '4',...
相关热词 c# login 居中 c# 考试软件 c# 自然语言分析 c# 分段读取文件 c# 泛型反射 c#打断点 c# 时间转多少秒 c# 线程函数加参数 c# modbus 读取 c#查询集合表