ext grid 数据加载成功,却显示不了数据

我的grid从后台加载数据成功,却显示不了数据 !

整体布局是一个viewport,左侧树形,右侧表格,当我单击树形的值时,在表格显示结果。

这是grid 代码:
CurrentDataGrid = function(viewer, config){
this.viewer = viewer;
Ext.apply(this, config);

this.store = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy({
        url: '../currentData/currentData_gridData.jspx'
    }),
    reader: new Ext.data.JsonReader({
        root: 'values',
        totalProperty: 'rows',
        remoteSort: true,
        fields: ["ammeterid", "ammeterno", "measureno", "ammindex", "termno", "equip", "elcplace", "elctype"]
    })
});
this.store.setDefaultSort('ammeterno', "DESC");


this.check_select = new Ext.grid.CheckboxSelectionModel({
    handleMouseDown: Ext.emptyFn
});
this.columns = [new Ext.grid.RowNumberer(), this.check_select, {
    id: 'ammeterid',
    header: "测量点ID",
    dataIndex: 'ammeterid',
    width: 50,
    hidden: true
}, {
    id: 'ammeterno',
    header: "通讯地址",
    dataIndex: 'ammeterno',
    sortable: true,
    width: 100
}, {
    id: 'measureno',
    header: "测量点号",
    dataIndex: 'measureno',
    sortable: true,
    width: 80
}, {
    id: 'ammindex',
    header: "表序号",
    dataIndex: 'ammindex',
    sortable: true,
    width: 50
}, {
    id: 'termno',
    header: "所属终端",
    dataIndex: 'termno',
    sortable: true,
    width: 100
}, {
    id: 'equip',
    header: "关联设备",
    dataIndex: 'equip',
    sortable: true,
    width: 100
}, {
    id: 'elcplace',
    header: "用电场所",
    dataIndex: 'elcplace',
    sortable: true,
    width: 100
}, {
    id: 'elctype',
    header: "用电类型",
    dataIndex: 'elctype',
    sortable: true,
    width: 100
}];
CurrentDataGrid.superclass.constructor.call(this, {
    region: 'center',
    id: 'CurrentDataGridID',
    sm: this.check_select
});

};
Ext.extend(CurrentDataGrid, Ext.grid.GridPanel, {
loadData: function(treeNodeID, selectType){
this.store.baseParams = {
treeValue_ID: treeNodeID,
selectType: selectType
};
this.store.load({
callback: function(r, options, success){
alert(r.length);
if (success) {
alert(r.length);
}
else {
alert("异常!");
}
}
});

}

});

后台返回数据:

{"rows":4,"values": [{"ammeterid":10,"ammeterno":"002084000075","measureno":112,"ammindex":12,"termno":"99999999","equip":"b- 12(一楼厂房)","elcplace":"照明用电场所","elctype":"办公照明用电"}, {"ammeterid":12,"ammeterno":"002084000066","measureno":114,"ammindex":14,"termno":"99999999","equip":"b- 14(四楼照明区)","elcplace":"照明用电场所","elctype":"办公照明用电"}, {"ammeterid":13,"ammeterno":"002084000067","measureno":115,"ammindex":15,"termno":"99999999","equip":"b- 15(三楼照明区)","elcplace":"照明用电场所","elctype":"办公照明用电"}, {"ammeterid":14,"ammeterno":"002084000069","measureno":116,"ammindex":16,"termno":"99999999","equip":"b- 16(五楼照明区)","elcplace":"照明用电场所","elctype":"办公照明用电"}]}

在IE和FF里都不显示数据,也不报错!用firebug调试了一下,可以看到从后台返回的数据,如下图所示

[img]http://dl.iteye.com/upload/attachment/288630/01887e97-8d5a-3f65-b16c-ee3117bcd3ec.jpg[/img]

4个回答




04.form



<br> Ext.onReady(function(){<br> CurrentDataGrid = function(viewer, config){ <br> this.viewer = viewer; <br> Ext.apply(this, config); </p> <pre><code>this.store = new Ext.data.Store({ reader: new Ext.data.JsonReader({ root: &#39;values&#39;, totalProperty: &#39;rows&#39;, remoteSort: true, fields: [&quot;ammeterid&quot;, &quot;ammeterno&quot;, &quot;measureno&quot;, &quot;ammindex&quot;, &quot;termno&quot;, &quot;equip&quot;, &quot;elcplace&quot;, &quot;elctype&quot;] }) }); this.store.setDefaultSort(&#39;ammeterno&#39;, &quot;DESC&quot;); this.check_select = new Ext.grid.CheckboxSelectionModel({ handleMouseDown: Ext.emptyFn }); this.columns = [new Ext.grid.RowNumberer(), this.check_select, { id: &#39;ammeterid&#39;, header: &quot;测量点ID&quot;, dataIndex: &#39;ammeterid&#39;, width: 50, hidden: true }, { id: &#39;ammeterno&#39;, header: &quot;通讯地址&quot;, dataIndex: &#39;ammeterno&#39;, sortable: true, width: 100 }, { id: &#39;measureno&#39;, header: &quot;测量点号&quot;, dataIndex: &#39;measureno&#39;, sortable: true, width: 80 }, { id: &#39;ammindex&#39;, header: &quot;表序号&quot;, dataIndex: &#39;ammindex&#39;, sortable: true, width: 50 }, { id: &#39;termno&#39;, header: &quot;所属终端&quot;, dataIndex: &#39;termno&#39;, sortable: true, width: 100 }, { id: &#39;equip&#39;, header: &quot;关联设备&quot;, dataIndex: &#39;equip&#39;, sortable: true, width: 100 }, { id: &#39;elcplace&#39;, header: &quot;用电场所&quot;, dataIndex: &#39;elcplace&#39;, sortable: true, width: 100 }, { id: &#39;elctype&#39;, header: &quot;用电类型&quot;, dataIndex: &#39;elctype&#39;, sortable: true, width: 100 }]; CurrentDataGrid.superclass.constructor.call(this, { region: &#39;center&#39;, id: &#39;CurrentDataGridID&#39;, sm: this.check_select }); </code></pre> <p>}; </p> <p>var s = {&quot;rows&quot;:4,&quot;values&quot;: [{&quot;ammeterid&quot;:10,&quot;ammeterno&quot;:&quot;002084000075&quot;,&quot;measureno&quot;:112,&quot;ammindex&quot;:12,&quot;termno&quot;:&quot;99999999&quot;,&quot;equip&quot;:&quot;b- 12(一楼厂房)&quot;,&quot;elcplace&quot;:&quot;照明用电场所&quot;,&quot;elctype&quot;:&quot;办公照明用电&quot;}, {&quot;ammeterid&quot;:12,&quot;ammeterno&quot;:&quot;002084000066&quot;,&quot;measureno&quot;:114,&quot;ammindex&quot;:14,&quot;termno&quot;:&quot;99999999&quot;,&quot;equip&quot;:&quot;b- 14(四楼照明区)&quot;,&quot;elcplace&quot;:&quot;照明用电场所&quot;,&quot;elctype&quot;:&quot;办公照明用电&quot;}, {&quot;ammeterid&quot;:13,&quot;ammeterno&quot;:&quot;002084000067&quot;,&quot;measureno&quot;:115,&quot;ammindex&quot;:15,&quot;termno&quot;:&quot;99999999&quot;,&quot;equip&quot;:&quot;b- 15(三楼照明区)&quot;,&quot;elcplace&quot;:&quot;照明用电场所&quot;,&quot;elctype&quot;:&quot;办公照明用电&quot;}, {&quot;ammeterid&quot;:14,&quot;ammeterno&quot;:&quot;002084000069&quot;,&quot;measureno&quot;:116,&quot;ammindex&quot;:16,&quot;termno&quot;:&quot;99999999&quot;,&quot;equip&quot;:&quot;b- 16(五楼照明区)&quot;,&quot;elcplace&quot;:&quot;照明用电场所&quot;,&quot;elctype&quot;:&quot;办公照明用电&quot;}]}; <br> Ext.extend(CurrentDataGrid, Ext.grid.GridPanel,{<br> renderTo:Ext.getBody(),<br> height:500<br> }); </p> <p>new CurrentDataGrid().store.loadData(s);</p> <p>});<br>




你的程序这样测试 发现没有问题 都出来了

fields: ["ammeterid", "ammeterno", "measureno", "ammindex", "termno", "equip", "elcplace", "elctype"]

改成

fields: [
{name:'ammeterid', mapping: 'ammeterid'},
{name:'ammeterno', mapping:'ammeterno'},
{name:'measureno', mapping:'measureno'}
{name:'ammindex', mapping:'ammindex'}
{name:'termno', mapping:'termno'}
{name:'equip', mapping:'equip'},
{name:'elcplace', mapping:'elcplace'},
{name:'elctype', mapping:'elctype'}
]
试试

fields: [
{name:'ammeterid', mapping: 'ammeterid'},
{name:'ammeterno', mapping:'ammeterno'},
{name:'measureno', mapping:'measureno'},
{name:'ammindex', mapping:'ammindex'},
{name:'termno', mapping:'termno'},
{name:'equip', mapping:'equip'},
{name:'elcplace', mapping:'elcplace'},
{name:'elctype', mapping:'elctype'}
]

没有刷新 只有取得grid然后 grid.store.load后台

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
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 显示数据
LearningExtJS 第五章节的翻译
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不显示数据
我用的是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数据加载树列表的问题
页面: rn 问题:页面布局是由center和south两部分组成,center是一个grid,south是有两个tab页组成,我得操作是点击上面表哥的一条记录,下面两个tab页信息进行加载,现在问题是基本信息可以加载,但是关联行业就不能加载,(其实我的目的就是想让这行业树reload一遍),但是会出错。rn  rn 用firefox时错误提示:uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMHTMLDivElement.appendChild]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: http://localhost:8080/rxtc-bi-web/bip/tp/ext-3.1.0/ext-all.js :: anonymous :: line 7" data: no]rn  rn 用IE8错误提示:类型不匹配,this.holder.appendChild(this.wrap)   rn  rn  rn center代码:rn   var reportIndustryQuery=new ReportIndustryQueryGrid();   frQueryGrid=new Ext.grid.GridPanel(    store:emStore,    height:400,    cm:cm,    border:false,    enableHdMenu : false,    viewConfig:forceFit:true,    loadMask: true,    selModel:new Ext.grid.CellSelectionModel(),//单元格选择       sm: new Ext.grid.RowSelectionModel(                 singleSelect: false,                 listeners:                     rowselect: function(sm, row, rec)                           Ext.getCmp("frInfo").getForm().loadRecord(rec);                           reportIndustryQuery.loadTreeData(rec.get("frTradeTyp"));                                                 ),       tbar: getParamGridToolBar(),       bbar: getPagingToolbar(emStore)       );rn  rn south代码:rn var ReportIndustryQueryGrid = function()    //GRID每页显示记录数  var pageSize = 10;  //当前选择的  var frTradeTyp;  //@private  //列树对象  var tradeTree;  var imagePath ='../../bip/images/ext2';    //@private  //初始化并取到行业树  var getTradeTree = function()    tradeTree = new Ext.tree.TreePanel(      id:'reprotType_tradeTree',      border:false,      useArrows:true,           autoScroll:true,           animate:false,           enableDD:false,           checked: false,//显示复选框           onlyLeafCheckable: false,//所有节点可选            rootVisible: true,           checkModel:'cascade',           loader : new Ext.tree.DWRTreeLoader(           dwrCall:frReportTradeTypeBB.getTradeTree,             baseAttrs: uiProvider: Ext.ux.TreeCheckNodeUI            ),           root: new Ext.tree.AsyncTreeNode(            text: '行业根节点',            draggable:false,                       id:'00000',            queryParam:,            expanded:false           ),           tbar:[text:'保存',handler:addTradeFun,tooltip:'保存行业',icon:imagePath+'/default/shared/save.gif',cls:'x-btn-text-icon',                 text:'刷新',handler:refreshFun,tooltip:'刷新行业',icon:imagePath+'/default/shared/save.gif',cls:'x-btn-text-icon',                 '->'],           listeners:       beforeload : function(node)        frTradeTyp=Ext.getCmp("frTradeTyp").getValue();        node.attributes.queryParam=frTradeTyp:frTradeTyp;        ,               checkchange : function(node, checked)                   if(checked)                       node.getUI().addClass('complete');                   else                       node.getUI().removeClass('complete');                                               );  ;  //@private  //对模板树或参数树进行查找  var refreshFun = function()   var typeId=Ext.getCmp("frTradeTyp").getValue();   tradeTree.getRootNode().reload();   rn  //@private  //初始化模板参数表格对象  var init = function()   getTradeTree();  ();rn  return     //@public     getTradeTree : function()    return tradeTree;          ,setFrTradeTypFun : function(selectId)         frTradeTyp=selectId;    frTradeTyp=Ext.getCmp("frTradeTyp").getValue();      /**    * 加载报表行业类别的行业    * @param selectId 行业类型编号    */   ,loadTreeData: function(selectId)    tradeTree.getRootNode().reload();        ; ;rn  rn  rn 当我点击south里面的树面板上有一个按钮“刷新”可以进行重新加载,但是通过点击center上面记录调用loadTreeData方法就不能刷新,为什么?rn  rn  
EXT grid 不显示
rnrn rn Examplern rn rn rnrn rn rn rn rnrn rn tablern rnrn
ext grid显示json数据
rnrnrnrnrnrnrn  
ext grid数据问题
比如现在grid中显示了10条数据, 这些数据有个状态 我想单击按钮的时候 显示着10条中状态等于1的数据 该怎么操作??rn如果有N条数据,分页之后还能维持这个状态查看......(这些数据不是写死的,是后台取出)
为什么读取成功却输出不了数据
[code=c] CString szPathc = CString(szPath);rn CString szPathopen = szPathc + "\\data.txt"; // DATA 内内容 中华人民rn //获取路经rn CString mass;rn CFile ReadeFile;rn char buf[1000];//读1Krn memset(buf, 0, 1000);//初始化内存,防止读出字符末尾出现乱码rn ReadeFile.Open(szPathopen, CFile::modeRead);rn rn ReadeFile.Read(buf, sizeof(buf));rn mass = CString(buf);rn MessageBox(mass); //输出为什么是空白rn ReadeFile.Close();[/code]
Ext中的grid的数据显示问题
从服务端获取到数据后,grid的该列值是0,或1,或-1;rn在ext展现时,需要将grid的该列展现分别对应为“审核中”,“通过”,“未通过”,ext应该如何实现呢?rn希望有此经验的GS们帮忙。。。。谢谢!
为什么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可以显示头部,但是内容显示不了
ext.jsrn[code=JScript]Ext.onReady(rn function()rn Ext.state.Manager.setProvider(new Ext.state.CookieProvider());rn function renderSex(value) rn if (value == 'male') rn return "红男";rn else rn return "绿女";rn rn rn var sm=new Ext.grid.CheckboxSelectionModel();rn var cm = new Ext.grid.ColumnModel([rn new Ext.grid.RowNumberer(),rn sm,rn header:'编号',sortable: true,dataIndex:'id',width: 100,rn header:'姓名',sortable: true,dataIndex:'name',width: 100,rn header:'性别',sortable: true,dataIndex:'sex',width: 100,renderer:renderSex,rn header:'描述',sortable: true,dataIndex:'descn',width: 100rn ]);rnrn var ds=new Ext.data.JsonStore(rn url:'grid.jsp',rn root:'root',rn fields : [name : 'id', name : 'name',name : 'sex', name : 'descn']rn );rnrn ds.load(params:start:0,limit:10);rn rn var grid=new Ext.grid.GridPanel(rn el: 'grid',rn sm:sm,rn ds:ds,rn cm:cm,rn bbar: new Ext.PagingToolbar(rn pageSize: 10,rn store: ds,rn displayInfo: true,rn displayMsg: '显示第 0 条到 1 条记录,一共 2 条',rn emptyMsg: '没有记录'rn ),rn height:500,rn width:600,rn title:'Array Grid'rn );rn grid.render(); rn);[/code]rnrngrid.jsprn[code=Java]<%rnString start = request.getParameter("start");rnString limit = request.getParameter("limit");rntry rn int index = Integer.parseInt(start);rn int pageSize = Integer.parseInt(limit);rnrn String json = "totalProperty:100,root:[";rn for (int i = index; i < pageSize + index; i++) rn json += "id:'" + i + "',name:'name" + i +"'sex:'sex"+i+ "',descn:'descn" + i + "'";rn if (i != pageSize + index - 1) rn json += ",";rn rn rn json += "]";rn response.getWriter().write(json);rn catch(Exception ex) rnrn%>rn[/code]
Ext Grid 表头显示问题
出现问题了,当 Grid div 放在 table 布局下的话 文档的docType采用html默认的doctype(不声明即可),如果采用xhtml或html4 strict则Ext会出现很多问题。 ie6 我碰到了!!!(IE7.0 firefox 没问题) 表头没了,见下图:     ...
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 列名不显示
很郁闷grid的列名就是不显示!!!当我把页面上的EXT的样式去掉就能显示了rn去掉这句代码 后gird的列名就可以显示,但是EXT的样式都没了!!!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急!!!
EXT grid 数据拖动的问题
我现在网页的布局用了一个Ext.Viewport 左边区域是一个Ext tree 右边区域是一个EXT grid 我现在要实现将grid中的数据拖拽到tree上,但是拖动的时候grid的数据只能在右边这个区域中拖动不能拖到左边的区域里,请问我怎么能让数据在整个Viewport中拖,而不是在Viewport的右边区域中拖rnrn解决追加100分
Ext grid 只显示一行数据
请教各位为什么grid只显示一行数据,以下是截图:rn[img=http://commondatastorage.googleapis.com/static.panoramio.com/photos/medium/44343728.jpg][/img]rn但实际上还是有数据的,就是被隐藏了:rn[img=http://commondatastorage.googleapis.com/static.panoramio.com/photos/medium/44343729.jpg][/img]rnjs代码中添加了高度设置,但是不管用:rnrn[code=JScript]rnuserManageWindow = Ext.extend(Ext.Panel, rn title : '用户管理',rn //width: 765,rn //height: 525,rn layout : 'fit',rn height: 600,rn initComponent : function() rn this.tbar = rn xtype : 'toolbar',rn items : [ rn id : '000002',rn xtype : 'button',rn text : '添加用户',rn listeners : rn 'click' : function() rn userWindow.show();rn rn rn , rn id : '000003',rn xtype : 'button',rn text : '修改所选用户'rn , rn id : '000004',rn xtype : 'button',rn text : '冻结所选用户'rn , rn id : '000005',rn xtype : 'button',rn text : '删除所选用户'rn , rn id : '000006',rn xtype : 'button',rn text : '查看用户列表',rn handler : getAllUserrn ]rn ;rn this.items = [ //Ext GRIDrn xtype : 'grid',rn id : 'userinfo',rn height: 500,rn columns : [ rn xtype : 'gridcolumn',rn dataIndex : 'string',rn header : '序号',rn sortable : true,rn width : 100rn , rn xtype : 'numbercolumn',rn dataIndex : 'number',rn header : '姓名',rn sortable : true,rn width : 100,rn align : 'right'rn , rn xtype : 'booleancolumn',rn dataIndex : 'bool',rn header : '所属组',rn sortable : true,rn width : 100rn , rn xtype : 'datecolumn',rn dataIndex : 'date',rn header : '当前状态',rn sortable : true,rn width : 100rn , rn xtype : 'datecolumn',rn dataIndex : 'date',rn header : '添加时间',rn sortable : true,rn width : 100rn , rn xtype : 'datecolumn',rn dataIndex : 'date',rn header : '添加人',rn sortable : true,rn width : 100rn ]rn ];rn this.bbar = rn xtype : 'paging',rn items : [ rn xtype : 'textfield'rn ]rn ;rn userManageWindow.superclass.initComponent.call(this);rn rnrn);rnrn/*rn * 添加或显示用户信息的窗体rn */rnvar userForm = new Ext.form.FormPanel( rn baseCls : 'x-plain',rn labelWidth : 55,rn url : 'addUser',rn layout : rn type : 'vbox',rn align : 'stretch' // Child items are stretched torn // full widthrn ,rn defaults : rn xtype : 'textfield'rn ,rnrn items : [ rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '用户名',rn name : 'username'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '用户ID',rn name : 'userid'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '所属部门',rn name : 'department'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '电话',rn name : 'tel'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '手机',rn name : 'cellphone'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '传真',rn name : 'fax'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '性别',rn name : 'sex'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '状态',rn name : 'status'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '所属组',rn name : 'usergroup'rn , rn plugins : [ Ext.ux.FieldLabeler ],rn fieldLabel : '备注',rn name : 'remark'rn ]rn);rnrnvar userWindow = new Ext.Window( rn id : 'userWindow',rn title : '用户信息',rn collapsible : false,rn maximizable : false,rn closable : false,rn width : 400,rn height : 350,rn minWidth : 300,rn minHeight : 150,rn layout : 'fit',rn plain : true,rn bodyStyle : 'padding:5px;',rn buttonAlign : 'center',rn items : userForm,rn buttons : [ rn id : 'btn_submit',rn text : '确定',rn handler : addUserrn , rn id : 'btn_reset',rn text : '取消',rn handler : hideUserWindowrn ]rn);rnrn//添加用户rnfunction addUser() rn userForm.getForm().submit( rn //clientValidation:true,rn waitMsg : '正在提交...',rn waitTitle : '正在提交',rn url : 'addUser',rn method : 'POST',rn failure : function(form, action) rn Ext.Msg.alert('添加用户', '用户已经存在');rn rn );rnrnrn//关闭添加用户的窗体rnfunction hideUserWindow() rn userWindow.hide();rnrnrn//获取所有用户rnfunction getAllUser() rnrn var ds= new Ext.data.Store( rn url:'http://127.0.0.1/oa/getAllUser',rn reader : new Ext.data.JsonReader(rn rn totalProperty : 'totalCount',rn root : 'data',rn id : 'userid',rn , [ rn name : 'userid',rn mapping : 'userid'rn , rn name : 'username',rn mapping : 'username'rn ]rn )rn );rn var colModel = new Ext.grid.ColumnModel( [ rn header : '用户ID',rn width : 120,rn sortable : true,rn dataIndex : 'userid'rn , rn header : '用户姓名',rn width : 120,rn sortable : true,rn dataIndex : 'username'rn ]);rn rn Ext.getCmp('userinfo').reconfigure(ds, colModel);rn ds.load();rnrn[/code]
求助Ext Grid无法显示数据
rn为什么我的ext Grid可以显示,但是没有数据显示。。。。求助大家看看我的问题吧rnrn后台代码:返回数据如下:'data':['OrderID':100,'Username':'linrd ','StatusID':1,'CreateTime':2010/7/31 21:10:13,'SubTotal':800.00,'OrderID':101,'Username':'linrd ','StatusID':11,'CreateTime':2010/8/1 9:08:01,'SubTotal':1350.00],'totalCount':1000rn代码如下:rnusing System;rnusing System.Collections.Generic;rnusing System.Linq;rnusing System.Web;rnusing System.Web.UI;rnusing System.Web.UI.WebControls;rnusing System.Data.SqlClient;rnusing Service;rnusing System.Xml;rnusing System.Text;rnpublic partial class Default2 : System.Web.UI.Pagernrn protected void Page_Load(object sender, EventArgs e)rn rn StringBuilder jsonStr = new StringBuilder();rn jsonStr.Append("'data':[");rn SqlConnection conn =new SqlConnection("server=.;database=ExtShop;uid=sa;password=123");rn string sqlstr = "select *from T_Orders";rn tryrn rn conn.Open();rn SqlCommand comm = new SqlCommand(sqlstr, conn); rn SqlDataReader rd = comm.ExecuteReader();rn while (rd.Read())rn rn jsonStr.Append("");rn jsonStr.Append("'OrderID':" + rd.GetInt32(0).ToString() + ",");rn jsonStr.Append("'Username':'" + rd.GetString(1) + "',");rn jsonStr.Append("'StatusID':" + rd.GetInt32(3).ToString() + ",");rn jsonStr.Append("'CreateTime':" + rd.GetDateTime(2) + ",");rn jsonStr.Append("'SubTotal':" + rd.GetSqlMoney(4).ToString() + "");rn jsonStr.Append(",");rn rn rn finallyrn rn conn.Close();rn rn jsonStr.Remove(jsonStr.Length - 1, 1);rn jsonStr.Append("],'totalCount':1000");rn Response.Write(jsonStr);rn rnrnrnjs代码如下:rnExt.onReady(function () rn Ext.QuickTips.init();rn var sm = new Ext.grid.CheckboxSelectionModel();rn var cm = new Ext.grid.ColumnModel([rn new Ext.grid.RowNumberer(),rn sm,rn header: 'OrderID', dataIndex: 'OrderID', align: 'center', width: 100 ,rn header: 'Username', dataIndex: 'Username', width: 100 ,rn header: 'StatusID', dataIndex: 'StatusID', align: 'center', width: 100 ,rn header: 'CreateTime', dataIndex: 'CreateTime', align: 'center', width: 100 ,rn header: 'SubTotal', dataIndex: 'SubTotal', align: 'center', width: 100 rn ]);rn cm.defaultSortable = true;rn var ds = new Ext.data.Store(rn autoLoad: true,rn proxy: new Ext.data.HttpProxy( url: 'Default2.aspx' ),rn reader: new Ext.data.JsonReader(rn root: 'data',rn totalProperty: 'totalCount'rnrn , ['OrderID', 'Username', 'StatusID', 'CreateTime', 'SubTotal']rn )rn );rn ds.load( params: start: 0, limit: 25 );rn var grid = new Ext.grid.GridPanel(rn el: 'content',rn data: ds,rn cm: cm,rn height: 400,rn title: '订单后台',rn bbar: new Ext.PagingToolbar(rn pageSize: 25,rn store: ds,rn displayInfo: true,rn displayMsg: '显示第 0 条到 1 条记录,一共 2 条',rn emptyMsg: "没有记录"rn )rn );rn grid.render();rnrn);rnrnhtml代码如下:rnrnrnrnrn rn rn rn rn rn rn rnrnrnrnrnrn rnrnrnrn
ext查询刷新grid数据
输入查询条件,让grid数据刷新。怎么实现?rnrn<%@page contentType="text/html; charset=utf-8" %>rnrn<%rn String query = (String)request.getAttribute("query");rn rn %>rn rn rn 图书条码: 销售日期: 书名: rn rnrn rnrnrn
EXT grid只显示一条数据;
/ 定义Proxyrnvar proxy = new Ext.data.HttpProxy(rn url : "plantsAction!getPlantsById.action"rn);rnrnvar Order = Ext.data.Record.create([rn name : "cabinetName",rn type : "string",rn mapping : "cabinetName"rn, rn name : "cabinetNO",rn type : "string",rn mapping : "cabinetNO"rn, rn name : "cabinetModel",rn type : "string",rn mapping : "cabinetModel"rn, rn name : "cabinetLocation",rn type : "string",rn mapping : "cabinetLocation"rn, rn name : "cabinetType",rn type : "string",rn mapping : "cabinetType"rn, rn name : "cabinetDutyRoleName",rn type : "string",rn mapping : "cabinetDutyRoleName"rn, rn name : "cabinetId",rn type : "string",rn mapping : "cabinetId"rn, rn name : "cabinetNotes",rn type : "string",rn mapping : "cabinetNotes"rn, rn name : "id",rn type : "int",rn mapping : "id",rn hidden : truernrn]);rnrn// 定义Readerrnvar reader = new Ext.data.JsonReader(rn totalProperty : "totalCount",rn root : "data"rn, Order);rn// 定义Storernvar devstore = new Ext.data.Store(rn proxy : proxy,rn reader : readerrn);rnrnvar devBoxAddrs = [["303", "303"], ["405", "405"]];rnrn// 定义列模型rnvar cm = new Ext.grid.ColumnModel([rn header : "机柜名称",rn dataIndex : "cabinetName",rn width : 120,rn align : "center",rn sortable : truernrn, rn header : "机柜编号",rn dataIndex : "cabinetNO",rn width : 100,rn align : "center",rn sortable : truern, rn header : "型号",rn dataIndex : "cabinetModel",rn width : 90,rn align : "center",rn sortable : truern, rn header : "位置",rn dataIndex : "cabinetLocation",rn width : 100,rn align : "center",rn sortable : truern, rn header : "规格类别",rn dataIndex : "cabinetType",rn width : 120,rn align : "center",rn sortable : truern, rn header : "负责岗位",rn dataIndex : "cabinetDutyRoleName",rn width : 100,rn align : "center",rn sortable : truern, rn id : "cabinetNotes",rn header : "描述",rn dataIndex : "cabinetNotes",rn width : 150,rn align : "center",rn sortable : truernrnrn]);rn// 分页控件 其实分页还是要后台控制的rnvar pagingBar = new Ext.PagingToolbar(rn autoWidth : true,rn pageSize : 10,rn displayInfo : true,rn emptyMsg : "没有数据显示",rn displayMsg : "显示从0条到1条数据,共2条数据",rn store : devstore,rn loadMask : truern);rnrn// 定义EditGridPanelrnvar useGrid = new Ext.grid.GridPanel(rn title : "已安装机柜列表视窗",rn store : devstore,rn cm : cm,rn // renderTo:"a",rn autoExpandColumn : "cabinetNotes",rn autoWidth : true,rn // height : 150,rn autoEncode : true, // 提交时是否自动编码rn tbar : ["-", rn text : "增加机柜",rn icon : "../../../extjs/resources/images/default/dd/drop-add.gif",rn handler : function() rn cabWin.show();rn rn , "-", rn text : "删除机柜",rn icon : "../../../extjs/resources/images/default/dd/drop-no.gif",rn cls : "x-btn-text-icon",rn handler : function() rn var sm = useGrid.getSelectionModel();rn if (sm.hasSelection()) rn Ext.Msg.confirm("提示", "真的要删除选中的行吗?", function(btn) rn if (btn == "yes") rn var rsm = useGrid.getSelectionModel();// 得到行选择模型rn var cabid = 0;rn var view = useGrid.getView();rn var store = useGrid.getStore();rn for (var i = view.getRows().length - 1; i >= 0; i--) rn if (rsm.isSelected(i)) rn cabid = useGrid.getStore().getAt(i)rn .get("cabinetId")rn + "," + cabid;rn store.remove(store.getAt(i));rn rn rn alert(cabid);rn Ext.Ajax.request(rn url : "cabinetAction!deleteCabinet.action?ids="rn + cabid,rn success : function(response, config) rn Ext.Msg.alert("提示", "删除客户端成功");rn var view = useGrid.getView();rn var store = useGrid.getStore();rn view.refresh();rn alert(useGrid.getStore().getAt(0)rn .get("cabinetId"));rn devstore.load(rn params : rn plantId : useGrid.getStore().getAt(0)rn .get("cabinetId"),rn start : 0,rn limit : 10rn rn )rn ,rn failure : function() rn Ext.Msg.alert("result:", "get failed");rn ,rn method : "get"rn )rn rn );rn else rn Ext.Msg.alert("错误", "请先选择删除的行,谢谢!");rn rn rnrn , "-"],rn bbar : pagingBarrnrn);rnrnrn后台输出的JSON数据rnrn"data":["FState":0,"address":"","cabinetDutyRoleId":"1","cabinetDutyRoleName":"系统管理员","cabinetDutyUserID":"1","cabinetDutyUserName":"邢涛 ","cabinetId":"8","cabinetLocation":"36#","cabinetModel":"42U","cabinetNO":"1#","cabinetName":"专用机柜1","cabinetNotes":"888888888","cabinetType":"服务器机柜","countCabinet":0,"createTime":"","creatorId":0,"deptId":0,"deptName":"","id":0,"name":"","notes":"","plantsNO":"","purpose":"","FState":0,"address":"","cabinetDutyRoleId":"1","cabinetDutyRoleName":"系统管理员","cabinetDutyUserID":"1","cabinetDutyUserName":"邢涛 ","cabinetId":"2","cabinetLocation":"1","cabinetModel":"1","cabinetNO":"2","cabinetName":"1","cabinetNotes":"1","cabinetType":"1","countCabinet":0,"createTime":"","creatorId":0,"deptId":0,"deptName":"","id":0,"name":"","notes":"","plantsNO":"","purpose":"","FState":0,"address":"","cabinetDutyRoleId":"1","cabinetDutyRoleName":"系统管理员","cabinetDutyUserID":"1","cabinetDutyUserName":"邢涛 ","cabinetId":"6","cabinetLocation":"36#","cabinetModel":"42U","cabinetNO":"3#","cabinetName":"专用机柜2","cabinetNotes":"888888888fdsgad","cabinetType":"其他","countCabinet":0,"createTime":"","creatorId":0,"deptId":0,"deptName":"","id":0,"name":"","notes":"","plantsNO":"","purpose":"","FState":0,"address":"","cabinetDutyRoleId":"1","cabinetDutyRoleName":"系统管理员","cabinetDutyUserID":"1","cabinetDutyUserName":"邢涛 ","cabinetId":"9","cabinetLocation":"36#","cabinetModel":"42U","cabinetNO":"1#","cabinetName":"专用机柜1","cabinetNotes":"888888888","cabinetType":"服务器机柜","countCabinet":0,"createTime":"","creatorId":0,"deptId":0,"deptName":"","id":0,"name":"","notes":"","plantsNO":"","purpose":""],"totalCount":4rnrnrn但是页面只显示一条了;
EXT数据加载的问题
    最近flex3学了不少,想着开始复习之前学过的ext,着手做一两个项目。我在EXT上停留的时间不短,对基本内容还是很清楚,对各种高级技法也有着应用,这次希望通过做项目来贯穿起来。     EXT中数据加载是一个细节问题,做不好会对web工程的效率影响很大,导致响应缓慢等问题。比如有这样一个需求:在一个panel中,上半部分是班级学生列表,下半部分是是一个成绩列表,当点击一行学生记录的时候...
EXt的数据加载与展示
工作中接触的系统的前台使用了EXT JS框架,数据加载方式是Ajax异步加载。前后台的数据交互格式是json格式。系统中最主要的数据展示是列表展示。现对上述数据的展示作出如下总结不足之处还望多多指教。 一、数据加载方式:     (1)Ext.data.JsonStore的使用                    Ext.data.JsonStore继承于Ext.data.Store,使得
Ext grid
如何获得grid的行数rn如何获得某个单元格的值rn如何让可编辑grid的单元格如果没有输入值,这个单元格就不会失去焦点rn可编辑的grid的单元格如果被编辑后,就会打上标记,有什么方法可以随意控制不要填上这个标记
ext grid
grid 中有几个字段,起始日期(startDate),设置日期(putDate),期限(deadline),备注(remark)rnrn如果 putDate 在 startDate 和 deadline 之间 备注显示 有效rn rn 否则 备注显示无效rnrn
Data Grid显示不了?什么原因
把data grid和ADO连接好了,用Recordset能得到字段内容rn可是在窗体上什么也显示不出来,这是为什么,rn要用什么函数激活么?
ext 2.2 加载不了数据
问题:运行以下html文件,加载不了从后台读取的数据。rn请大哥大姐们帮个忙。。小弟是初学者。rnrnaction 代码如下:rn[code=Java]rnpackage com.yourcompany.struts.action;rnrnimport java.io.IOException;rnimport java.io.PrintWriter;rnimport java.util.List;rnrnimport javax.servlet.http.HttpServletRequest;rnimport javax.servlet.http.HttpServletResponse;rnrnimport org.apache.struts.action.ActionForm;rnimport org.apache.struts.action.ActionForward;rnimport org.apache.struts.action.ActionMapping;rnimport org.apache.struts.actions.DispatchAction;rnrnimport com.yourcompany.dao.UserDao;rnimport com.yourcompany.model.User;rnimport com.yourcompany.struts.form.UserForm;rnrnrnpublic class UserAction extends DispatchAction rn rn public ActionForward queryAll(ActionMapping mapping, ActionForm form,rn HttpServletRequest request, HttpServletResponse response) rn UserForm userForm = (UserForm) form;rn UserDao dao = new UserDao();rn List list = dao.queryAll();rn rn StringBuffer str = new StringBuffer();rn str.append("[");rn rn for(int i=0;irnrn rn queryUser.htmlrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn[/code]rn
Windwos API, WC_LISTVIEW 插入元组成功却显示不了?
rn新建一个windows窗口,类型为WC_LISTVIEW,使用SendMessage插入元素,研究了半天,一直找不到插入元素失败的原因。SendMessage返回的结果是插入成功,不过却不能看见元组出现在列表中。rnrn[code=c]rnBOOL KScreenshotWindow::_CreateButtomListWindow()rnrn INITCOMMONCONTROLSEX iCex;rnrn // Ensure that the common control DLL is loaded. rnrn iCex.dwSize = sizeof(INITCOMMONCONTROLSEX);rn iCex.dwICC = ICC_LISTVIEW_CLASSES;rn InitCommonControlsEx(&iCex); rnrn // Create the list-view window in report view with label rn // editing enabled.rnrn m_hButtomListView = rn ::CreateWindow (rn WC_LISTVIEW, /// ListBox, rn L"MyListButtom", rn WS_CHILD| ///WS_VISIBLE |rn LVS_ALIGNLEFT | rn LVS_REPORT ///| LVS_ALIGNTOP | LVS_EDITLABELS | rn/// LVS_ICON | rn /// LVS_NOCOLUMNHEADER | LVS_NOSCROLLrn ,rn /// LVS_LIST | LVS_NOLABELWRAP rn 0, rn 0, rn 1000, /// button加起来的长度rn 100, /// button的高度rn m_hWindows, rn NULL,rn m_hInst, rn NULLrn ); rnrn if (NULL == m_hButtomListView)rn rn return FALSE; rn rnrn LV_COLUMN lvcColumn;rn lvcColumn.mask = LVCF_TEXT | LVCF_WIDTH; /// LVCF_IMAGErn lvcColumn.mask |= LVCF_FMT;rn lvcColumn.fmt = LVCFMT_LEFT;rn lvcColumn.cx = 50; /// 单个图标的像素rn lvcColumn.pszText = L"功能";rn SendMessage(m_hButtomListView, LVM_INSERTCOLUMN, nColumnFunId, (LPARAM)&lvcColumn);rnrn LVITEM lvcItem;rn lvcItem.mask = LVCF_TEXT; /// LVCF_IMAGErn lvcItem.iItem = 0;rn lvcItem.iSubItem = 0;rn lvcItem.lParam = nColumnFunId;rnrn LONG nRes = 110;rn lvcItem.pszText = L"square";rn nRes = SendMessage(m_hButtomListView, LVM_INSERTITEM, 0, (LPARAM)&lvcItem);rn rn /// 这里断点nRes返回的是0,插入成功,但是却不能显示rnrn lvcItem.pszText = L"circle";rn SendMessage(m_hButtomListView, LVM_INSERTITEM, 0, (LPARAM)&lvcItem);rn lvcItem.pszText = L"finish";rn SendMessage(m_hButtomListView, LVM_INSERTITEM, 0, (LPARAM)&lvcItem);rnrnrn ShowWindow(m_hButtomListView, SW_SHOW);rn UpdateWindow(m_hButtomListView);rn return TRUE;rnrn[/code]
fckeditor上传图片成功,前台页面却显示不了图片
config文件这样设置的rn$Config['UserFilesPath'] = '/shaoer1/houtai/upimagesimage/' ;rn$Config['UserFilesAbsolutePath'] = '' ;rn我上传图片后,'/shaoer1/houtai/upimagesimage/image文件夹里也有了上传的图片,而且fckeditor编辑器中图片也显示了出来,但是我保持到数据库后,再在前台页面读取数据库内容,文字都可以显示,但就是图片显示不了,请问这是怎么回事如何解决
Extjs grid 数据显示
我想问问大家的是:grid中的数据显示,在grid中所有的数字型数据都会显示为两位小数形式(本来就单单是纯整数的),有谁可以帮帮我吗, 谢谢大家了......
编译成功却运行不了,怎么回事?
下面是VC6的提示rnrn--------------------Configuration: main - Win32 Debug--------------------rnLinking...rnmain.obj : error LNK2001: unresolved external symbol "double __cdecl grade(struct Student_info const &)" (?grade@@YANABUStudent_info@@@Z)rnmain.obj : error LNK2001: unresolved external symbol "class std::basic_istream > & __cdecl read(class std::basic_istream > &,struct Student_info &)" (?read@@YAAAV?$basic_istream@DrnU?$char_traits@D@std@@@std@@AAV12@AAUStudent_info@@@Z)rnDebug/main.exe : fatal error LNK1120: 2 unresolved externalsrnError executing link.exe.rnrnmain.exe - 3 error(s), 0 warning(s)
EXT显示数据问题
我从数据库获得了数据 是这种形式rn"code":"datadict2","id":4,"name":"数据字典2","parentId":4rn想要显示在[code=JScript]dataDictTabPanel = Ext.extend(Ext.FormPanel,rn //定义构造器rn constructor: function()rn var dataDictId = new Ext.form.TextField(rn id: 'dataDictId',rn name : 'dataDictId',rn fieldLabel: '数据字典ID',rn anchor : '90%'rn ); rn var dataDictName = new Ext.form.TextField(rn id: 'dataDictName',rn name : 'dataDictName',rn fieldLabel: '数据字典名称',rn anchor : '90%'rn ); rn var dataDictCode = new Ext.form.TextField(rn id: 'dataDictCode',rn name : 'dataDictCode',rn fieldLabel: '数据字典编码',rn anchor : '90%'rn ); rn dataDictTabPanel.superclass.constructor.call(this,rn labelAlign: "right",rn buttonAlign: "right",rn frame: true,rn bodyStyle: "padding:0 0",rn autoScroll: true,rn items: [rn layout: "column",rn items: [rn columnWidth: 1,rn layout: 'form',rn defaultType: 'textfield',rn items: [dataDictId, dataDictName, dataDictCode]rn ]rn ]rn );rn rn rn );[/code]rnrn原本用的是这种方式 [code=JScript]var json = response.responseText;rn var json = eval("("+json+")");rn Ext.getCmp('dataDictId').setValue(json.id);rn Ext.getCmp('dataDictName').setValue(json.name);rn Ext.getCmp('dataDictCode').setValue(json.code);[/code]rnrn但是涉及到重用的问题 有bug,想要使用[code=JScript]var record = this.lawExpMaintenanceGridPanel.getSelectionModel().getSelected();rn this.showWin("edit");rn //表单加载数据rn this.lawExpMaintenanceFp.form.loadRecord(record);[/code]rn这种record形式 但是不知道怎么把从转换成 record 的 求大侠们帮帮忙 真的很急
类似于Ext Grid的新数据显示插件.net实现例子
AxioGrid与.NET ashx实现类似于Ext Grid的分页、排序、过滤等功能
新手用Ext JsonReader 做grid 没有数据显示
我仿照Ext给的grid 例子自己做,只是把数组换成了json格式的数据,但是只有header显示了 里面没有数据rn也不报错 不只是哪的问题?下卖弄是我的代码rnrnExt.onReady(function()rnrn Ext.state.Manager.setProvider(new Ext.state.CookieProvider());rnrnrn alert(1111);rn mydata ="row":[rn id:'0',na:'name0',descn:'descn0',rn id:'1',na:'name1',descn:'descn1',rn id:'2',na:'name2',descn:'descn2',rn id:'3',na:'name3',descn:'descn3',rn id:'4',na:'name4',descn:'descn4',rn id:'5',na:'name5',descn:'descn5',rn id:'6',na:'name6',descn:'descn6',rn id:'7',na:'name7',descn:'descn7',rn id:'8',na:'name8',descn:'descn8',rn id:'9',na:'name9',descn:'descn9'rn ];rn rn var ds = new Ext.data.Store(rn proxy: new Ext.data.MemoryProxy(mydata),rn reader: new Ext.data.JsonReader(rn root: 'row'rn , [name: 'id',name: 'na',name: 'descn'])rn );rn rn var json =[rn rn header:'value1',dataIndex:'id',rn header:'value2',dataIndex:'na',rn header:'value3',dataIndex:'descn'rn rn ];rn rn json = new Ext.grid.ColumnModel(json); rn rn var grid = new Ext.grid.GridPanel( rn el:'grid-example',rn ds:ds,rn cm:json,rn stripeRows: true, rn //autoExpandColumn: 'na0',rn height:350,rn width:600,rn title:'Array Grid'rn );rnrn grid.render();rn rn grid.getSelectionModel().selectFirstRow();rn);rnrnrnrnrn
为何ext的grid显示的表格里没数据呢?
Ext.onReady(function()rn Ext.QuickTips.init();rnrnvar PresidentsDataStore; // this will be our datastorernvar PresidentsColumnModel; // this will be our columnmodelrnvar PresidentListingEditorGrid;rnvar PresidentListingWindow;rnrnPresidentsDataStore = new Ext.data.Store(rn id: 'PresidentsDataStore',rn data: total:2, results:[[1, 'a', 'b', 1, '象', '1999/1/1', '2003/1/1', 999],[2, 'c', 'd', 2, '驴', '1999/1/1', '2003/1/1', 888]],rn reader: new Ext.data.JsonReader( // we tell the datastore where to get his data fromrn root: 'results',rn totalProperty: 'total',rn id: 'IDpresident'rn ,[ rn name: 'IDpresident', type: 'int', mapping: 'IDpresident',rn name: 'FirstName', type: 'string', mapping: 'firstname',rn name: 'LastName', type: 'string', mapping: 'lastname',rn name: 'IDparty', type: 'int', mapping: 'IDparty',rn name: 'PartyName', type: 'string', mapping: 'name',rn name: 'TookOffice', type: 'string', mapping: 'tookoffice',rn name: 'LeftOffice', type: 'string', mapping: 'leftoffice',rn name: 'Income', type: 'float', mapping: 'income'rn ]),rn sortInfo:field: 'IDpresident', direction: "ASC"rn );rnrnPresidentsColumnModel = new Ext.grid.ColumnModel(rn [rn header: '#',rn readOnly: true,rn dataIndex: 'IDpresident', // this is where the mapped name is important!rn width: 50,rn hidden: falsern ,rn header: 'First Name',rn dataIndex: 'FirstName',rn width: 150,rn editor: new Ext.form.TextField( // rules about editingrn allowBlank: false,rn maxLength: 20,rn maskRe: /([a-zA-Z0-9\s]+)$/ // alphanumeric + spaces allowedrn )rn ,rn header: 'Last Name',rn dataIndex: 'LastName',rn width: 150,rn editor: new Ext.form.TextField(rn allowBlank: false,rn maxLength: 20,rn maskRe: /([a-zA-Z0-9\s]+)$/rn )rn ,rn header: 'ID party',rn readOnly: true,rn dataIndex: 'IDparty',rn width: 50,rn hidden: true // we don't necessarily want to see this...rn ,rn header: 'Party',rn dataIndex: 'PartyName',rn width: 150,rn readOnly: truern ,rn header: "Income",rn dataIndex: 'Income',rn width: 150,rn renderer: function(v) return '$ ' + v; , // we tell Ext how to display the numberrn editor: new Ext.form.NumberField(rn allowBlank: false,rn decimalSeparator : ',',rn allowDecimals: true,rn allowNegative: false,rn blankText: '0',rn maxLength: 11rn )rn ]rn );rn PresidentsColumnModel.defaultSortable= true;rnrnPresidentListingEditorGrid = new Ext.grid.EditorGridPanel(rn id: 'PresidentListingEditorGrid',rn store: PresidentsDataStore, // the datastore is defined herern cm: PresidentsColumnModel, // the columnmodel is defined herern enableColLock:false,rn clicksToEdit:1,rn selModel: new Ext.grid.RowSelectionModel(singleSelect:false)rn );rn rn PresidentListingWindow = new Ext.Window(rn id: 'PresidentListingWindow',rn title: 'The Presidents of the USA',rn closable:true,rn width:700,rn height:350,rn plain:true,rn layout: 'fit',rn items: PresidentListingEditorGrid // We'll just put the grid in for now...rn );rn rn //PresidentsDataStore.load(); // Load the datarn PresidentListingWindow.show(); // Display our windowrn);
ext Grid 不显示数据.在线等.求助...
"acutalAmount":2,"fullname":"cvb","idNo":"231231212","profileNo":"PN20120315093821-0250","recordId":1,"standAmount":0,"startTime":1330704000000,"userId":4rnrnrn这是json的数据. rnrnjs是rn[code=JScript]PersonalSalaryView = function() rn return new Ext.Panel(rn id : 'PersonalSalaryView',rn title : '个人薪酬纪录',rn iconCls:'menu-personal-salary',rn autoScroll : true,rn items : [new Ext.FormPanel(rn height : 35,rn frame : true,rn id : 'PersonalSalaryForm',rn layout : 'column',rn defaults : rn xtype : 'label'rn ,rn items : [rn text : "查询条件:日期从"rn ,rn rn name : "Q_startTime_D_GE",rn width : 100,rn xtype : "datefield",rn format : "Y-m-d"rn ,rn rn text : "至"rn ,rn rn name : "Q_endTime_D_LE",rn width : 100,rn xtype : "datefield",rn format : "Y-m-d"rn ,rn rn xtype : "button",rn text : "查询",rn iconCls : "search",rn handler : function() rn var searchPanel = Ext.getCmp('PersonalSalaryForm');rn var grid = Ext.getCmp('PersonalSalaryGrid');rn if (searchPanel.getForm().isValid()) rn searchPanel.getForm().submit(waitMsg : '正在提交查询',rn url : __ctxPath + '/hrm/listSalaryPayoff.do',rn success : function(formPanel,action) rn var result = Ext.util.JSON.decode(action.response.responseText);rn grid.getStore().loadData(result);rn );rn rnrn rn ]rn), this.setup()]rn );rn;rn/**rn * 建立视图rn */rnPersonalSalaryView.prototype.setup = function() rn return this.grid();rn;rn/**rn * 建立DataGridrn */rnPersonalSalaryView.prototype.grid = function() rn var sm = new Ext.grid.CheckboxSelectionModel();rn var cm = new Ext.grid.ColumnModel(rn columns : [sm, new Ext.grid.RowNumberer(), rn header : 'recordId',rn dataIndex : 'recordId',rn hidden : truern , rn header : '员工姓名',rn dataIndex : 'fullname'rn , rn header : '档案编号',rn dataIndex : 'profileNo'rn , rn header : '身份证号',rn dataIndex : 'idNo'rn , rn header : '薪标金额',rn dataIndex : 'standAmount',rn renderer : function(e) rn return '' + e;rn rn , rn header : '实发金额',rn dataIndex : 'acutalAmount',rn renderer : function(e) rn return '' + e;rn rn ,rn header : "薪酬日期",rn width : 130,rn dataIndex : "startTime",rn renderer : function(h, g, e, i, f) rn return h.substring(0, 10) + "--"rn + e.data.endTime.substring(0, 10);rn rn ],rn defaults : rn sortable : true,rn menuDisabled : false,rn width : 100rn rn );rn var store = this.store();rn store.load(rn params : rn start : 0,rn limit : 25rn rn );rn var grid = new Ext.grid.GridPanel(rn id : 'PersonalSalaryGrid',rn store : store,rn trackMouseOver : true,rn disableSelection : false,rn loadMask : true,rn autoHeight : true,rn cm : cm,rn sm : sm,rn viewConfig : rn forceFit : true,rn enableRowBody : false,rn showPreview : falsern ,rn bbar : new Ext.PagingToolbar(rn pageSize : 25,rn store : store,rn displayInfo : true,rn displayMsg : '当前显示从0至1, 共2条记录',rn emptyMsg : "当前没有记录"rn )rn );rn return grid;rnrn;rnrn/**rn * 初始化数据rn */rnPersonalSalaryView.prototype.store = function() rn var store = new Ext.data.Store(rn proxy : new Ext.data.HttpProxy(rn url : __ctxPath + '/hrm/listSalaryPayoff.do'rn ),rn root : "result", rn reader : new Ext.data.JsonReader(rn root : 'result',rn totalProperty : 'totalCounts',rn id : 'id',rn fields : [rn name : 'recordId',rn type : 'int'rn rn ,'fullname', 'userId', 'profileNo', 'idNo', 'standAmount','acutalAmount','startTime']rn ),rn remoteSort : truern );rn store.setDefaultSort('recordId', 'desc');rn return store;rn;rn[/code]
实在没办法了ext grid不显示数据啊
var store = Ext.create('Ext.data.Store', rn rnmodel:'Task',rnproxy : new Ext.data.HttpProxy(rnurl : 'detail_qurey.asp?projectid='+projectid, //说明后台的serverletrnmethod : 'POST'rn),rn rnreader : new Ext.data.JsonReader(rnroot : "rows",rntotalProperty : 'total',rnid: 'itemid'rn,Task), //说明数据结构rnrnsortInfo : property: 'itemid', direction: 'ASC', rngroupField: 'bigitem'rn );rnstore.load(rn scope : store ,rn callback: function(records, operation, success) rnif (success) rn alert(records.length);rnrn rn);rn我不知道为什么不显示数据,alert(records.length)为1,在firebug里面查看json是有的啊rn"rows":["itemid":1,"itemname":"\u5730\u9762","bigitem":"\u53A8\u623F","unitprice":"20","unit":null,"size":"100","price":null,"content":null],"total":1rn但是 alert(records[0].get('itemname'));为空 。始终没数据显示的,哪位哥有经验求教啊,谢谢了,分不多rn
Ext数据扩展显示
  //有些大数据量放在列信息里面会占据较大的位置,影响界面美观,可以把它进行缩放 1. 定义该数据的缩放信息      var myExpander = new Ext.grid.RowExpander({ tpl : new Ext.Template('&amp;lt;p style=&quot;color:#999;margin:2px 0px 2px 48px;&quot;&amp;gt;{acontent}&amp;l...
Ext数据显示问题
[code=JScript] rn[/code]rnrn为什么不显示,那里错了
相关热词 c#检测非法字符 c#双屏截图 c#中怎么关闭线程 c# 显示服务器上的图片 api嵌入窗口 c# c# 控制网页 c# encrypt c#微信网页版登录 c# login 居中 c# 考试软件