Extjs有关于form动态获取数据的问题
先上一段代码:这段代码中的属性fieldLabel中的arr是一个数组,取到了数据。如图:这些数据已经获取成功,但是我想把这些数据给分别显示在fieldLabel的位置,...
先上一段代码:
这段代码中的属性fieldLabel中的arr是一个数组,取到了数据。如图:
这些数据已经获取成功,但是我想把这些数据给分别显示在fieldLabel的位置,也就是逗号隔开的每一个值分别作为form表单中的textfield前面的显示部分,这要怎么实现??求指教啊。小弟很着急谁能帮我下 展开
这段代码中的属性fieldLabel中的arr是一个数组,取到了数据。如图:
这些数据已经获取成功,但是我想把这些数据给分别显示在fieldLabel的位置,也就是逗号隔开的每一个值分别作为form表单中的textfield前面的显示部分,这要怎么实现??求指教啊。小弟很着急谁能帮我下 展开
1个回答
展开全部
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="../extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../extjs/ext-all.js"></script>
<script type="text/javascript" src="../extjs/src/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="../js/public.js"></script>
<script type="text/javascript">
var grid,grid1,grid2;
var store,store2,store1;
var myData = [];
var myData1 = [];
var fp,fp1,fp2;
var win1,win2,win3;
var cm,cm1,cm2;
Ext.onReady(function(){
var sm = new Ext.grid.CheckboxSelectionModel();
function getColumnModel(){
var cols=[];
cols[cols.length]=new Ext.grid.RowNumberer();
cols[cols.length]={id:'intID',header: "ID",align: 'center',width: 50,dataIndex: 'intID',hidden: true};
cols[cols.length]={id:'day_date',header: "时间1",align: 'center',width: 150,dataIndex: 'day_date'};
cols[cols.length]={id:'Model',header: "MODEL",align: 'center',width: 80,dataIndex: 'Model'};
cols[cols.length]={id:'Item',header: "ITEM",align: 'center',width: 80,dataIndex: 'Item'};
cols[cols.length]={id:'Line',header: "线别",align: 'center' ,width: 80,dataIndex: 'Line'};
cols[cols.length]={id:'classother',header: "班别",align: 'center',width: 80,dataIndex: 'classother'};
cols[cols.length]={id:'Sect',header: "段别",align: 'center',width: 80,dataIndex: 'Sect'};
cols[cols.length]={id:'Ng_Qty',header: "不良数量",align: 'center',width: 120,dataIndex: 'Ng_Qty',listeners: { rowselect: function(cm, row, rec) { alert(row); } }};
cols[cols.length]={id:'Fae_Qty',header: "维修数量",align: 'center',width: 80,dataIndex: 'Fae_Qty'};
cols[cols.length]={id:'Wait_For_Qty',header: "待修数量",align: 'center',width: 120,dataIndex: 'Wait_For_Qty'};
cols[cols.length]={id:'Rate',header: "比率",align: 'center',width: 100,dataIndex: 'Rate'};
cols[cols.length]=sm;
cm = new Ext.grid.ColumnModel(cols);
return cm;
}
var Plant = Ext.data.Record.create([/*数据工厂*/
//start_pn,end_pn,model,item,ver,buyer,rom_ver,DISTRIBUTE_qty,work_user
{name: 'intID', type: 'int'},
{name: 'day_date', type: 'string'},
{name: 'Model', type: 'string'},
{name: 'Item', type: 'string'},
{name: 'Line', type: 'string'},
{name: 'classother', type: 'string'},
{name: 'Sect', type: 'string'},
{name: 'Ng_Qty', type: 'string'},
{name: 'Fae_Qty', type: 'string'},
{name: 'Wait_For_Qty', type: 'string'},
{name: 'Rate', type: 'string'},
sm,
]);
store = new Ext.data.Store({/*数据仓库,装载在数据工厂里面*/
proxy: new Ext.data.HttpProxy({url:'../SfcStateServlet'}),
reader: new Ext.data.JsonReader({root: 'root', totalProperty : 'totalProperty',id: 'intID'}, Plant)
});
store.load();
cm=getColumnModel();
grid = new Ext.grid.GridPanel({
id:'mygrid',
frame: false,
store: store,
cm:cm,
sm:sm,
width: window.document.body.clientWidth * 1.00,
height: 150,
collapsible: false,
collapsed : false,
border:false,
autoScroll:true,
stripeRows: true
});
var pp=new Ext.Panel({
title:document.title,
width: window.document.body.clientWidth * 1.00,
height: window.document.body.clientHeight * 1.00,
renderTo:"gridbasic",
items:[{
title:"维修比例",
closable:true,
items:grid
} ]
});
});
</script>
</head>
<body style="margin:0px;background-color:#EAEEF7;overflow:hidden;">
<input disabled='false' name='Rate' value='999' style='width:35%;height: 20px' align="bottom" >
<form name="mainform" action="">
<div id="gridbasic"></div>
</form>
<div id="panelbasic"></div>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css" />
<script type="text/javascript" src="../extjs/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="../extjs/ext-all.js"></script>
<script type="text/javascript" src="../extjs/src/locale/ext-lang-zh_CN.js"></script>
<script type="text/javascript" src="../js/public.js"></script>
<script type="text/javascript">
var grid,grid1,grid2;
var store,store2,store1;
var myData = [];
var myData1 = [];
var fp,fp1,fp2;
var win1,win2,win3;
var cm,cm1,cm2;
Ext.onReady(function(){
var sm = new Ext.grid.CheckboxSelectionModel();
function getColumnModel(){
var cols=[];
cols[cols.length]=new Ext.grid.RowNumberer();
cols[cols.length]={id:'intID',header: "ID",align: 'center',width: 50,dataIndex: 'intID',hidden: true};
cols[cols.length]={id:'day_date',header: "时间1",align: 'center',width: 150,dataIndex: 'day_date'};
cols[cols.length]={id:'Model',header: "MODEL",align: 'center',width: 80,dataIndex: 'Model'};
cols[cols.length]={id:'Item',header: "ITEM",align: 'center',width: 80,dataIndex: 'Item'};
cols[cols.length]={id:'Line',header: "线别",align: 'center' ,width: 80,dataIndex: 'Line'};
cols[cols.length]={id:'classother',header: "班别",align: 'center',width: 80,dataIndex: 'classother'};
cols[cols.length]={id:'Sect',header: "段别",align: 'center',width: 80,dataIndex: 'Sect'};
cols[cols.length]={id:'Ng_Qty',header: "不良数量",align: 'center',width: 120,dataIndex: 'Ng_Qty',listeners: { rowselect: function(cm, row, rec) { alert(row); } }};
cols[cols.length]={id:'Fae_Qty',header: "维修数量",align: 'center',width: 80,dataIndex: 'Fae_Qty'};
cols[cols.length]={id:'Wait_For_Qty',header: "待修数量",align: 'center',width: 120,dataIndex: 'Wait_For_Qty'};
cols[cols.length]={id:'Rate',header: "比率",align: 'center',width: 100,dataIndex: 'Rate'};
cols[cols.length]=sm;
cm = new Ext.grid.ColumnModel(cols);
return cm;
}
var Plant = Ext.data.Record.create([/*数据工厂*/
//start_pn,end_pn,model,item,ver,buyer,rom_ver,DISTRIBUTE_qty,work_user
{name: 'intID', type: 'int'},
{name: 'day_date', type: 'string'},
{name: 'Model', type: 'string'},
{name: 'Item', type: 'string'},
{name: 'Line', type: 'string'},
{name: 'classother', type: 'string'},
{name: 'Sect', type: 'string'},
{name: 'Ng_Qty', type: 'string'},
{name: 'Fae_Qty', type: 'string'},
{name: 'Wait_For_Qty', type: 'string'},
{name: 'Rate', type: 'string'},
sm,
]);
store = new Ext.data.Store({/*数据仓库,装载在数据工厂里面*/
proxy: new Ext.data.HttpProxy({url:'../SfcStateServlet'}),
reader: new Ext.data.JsonReader({root: 'root', totalProperty : 'totalProperty',id: 'intID'}, Plant)
});
store.load();
cm=getColumnModel();
grid = new Ext.grid.GridPanel({
id:'mygrid',
frame: false,
store: store,
cm:cm,
sm:sm,
width: window.document.body.clientWidth * 1.00,
height: 150,
collapsible: false,
collapsed : false,
border:false,
autoScroll:true,
stripeRows: true
});
var pp=new Ext.Panel({
title:document.title,
width: window.document.body.clientWidth * 1.00,
height: window.document.body.clientHeight * 1.00,
renderTo:"gridbasic",
items:[{
title:"维修比例",
closable:true,
items:grid
} ]
});
});
</script>
</head>
<body style="margin:0px;background-color:#EAEEF7;overflow:hidden;">
<input disabled='false' name='Rate' value='999' style='width:35%;height: 20px' align="bottom" >
<form name="mainform" action="">
<div id="gridbasic"></div>
</form>
<div id="panelbasic"></div>
</body>
</html>
更多追问追答
追问
大哥,你确定没看错我的需求吗。。。。真心求助啊
追答
我看到了。你的想法是不错。
但是如果你把arr放进去。那name是不是都一样的。如果设置ID,是不是也是一样的。
那么在其他地方需要调用此表中某一列信息时。请问。那么和ID一样的情况下。你怎么取。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询