Extjs 在Rowexpander插件中循环Json数组
我有一个网格,我想显示额外的信息与RowExpander插件。当用户单击Extjs 在Rowexpander插件中循环Json数组,extjs,Extjs,我有一个网格,我想显示额外的信息与RowExpander插件。当用户单击交叉点时,json数组应该在扩展行中可用。我尝试了一切,但没有成功地显示扩展的内容 plugins: [{ ptype: "rowexpander", rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>'] }], 当我单击十字时,我可以在控制台中看到json数组,它工作得
交叉点时
,json数组应该在扩展行中可用。我尝试了一切,但没有成功地显示扩展的内容
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
当我单击十字时,我可以在控制台中看到json数组,它工作得很好。但是,阵列内容在模板中不可用
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
你能帮帮我吗,我做错了什么
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
JSON数组(普通网格数据)
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
JSON数组(扩展内容)
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
EXTJS
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
var formStore=new Ext.data.JsonStore({
url:“form data.php”,
root:'fdata',
idProperty:“表单ID”,
remoteSort:是的,
字段:[“表格ID”、“供应商编号”、“供应商名称”、“记录日期”、“交货编号”、“驾驶员姓名”、“车牌号”,
{name:'GRAND_TOTAL',键入:'float'}]
});
setDefaultSort('RECORD_DATE','asc');
var checkboxSel=new Ext.grid.CheckboxSelectionModel();
var rowExpander=new Ext.grid.rowExpander({});
on('beforeexpand',函数(rowExpander,record,body,rowindex){
Ext.Ajax.request({
url:'form details.php'+'?fid='+record.get('form_ID'),
方法:“GET”,
成功:功能(结果、请求){
var jsonData=Ext.util.JSON.decode(result.responseText);
tpl.覆盖(正文,jsonData);
},
失败:功能(结果、请求){
Ext.MessageBox.alert('Failed',result.responseText);
返回false;
}
});
返回true;
});
var tpl=新的外部模板(
“URUN-ADI:{PRODUCT_-NAME}
”,
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
“TOPLAM:{QUANTITY}”
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
);
Ext.onReady(函数(){
var grid=新建Ext.grid.GridPanel({
标题:“ME.117.10-哈马利耶福尔摩”,
商店:formStore,
sm:checkboxSel,
栏目:[
checkboxSel、rowExpander、,
{标题:“ID”,
宽度:40,
dataIndex:'FORM_ID',
可排序:false
},
{标题:“SatıcıNo”,
id:'表格id',
数据索引:“供应商编号”,
宽度:40,
可排序:false
},
{标题:“SatıcıFirma”,
数据索引:“供应商名称”,
宽度:290,
可排序:正确
},
{标题:“Kayıt Tarihi”,
宽度:80,
数据索引:“记录日期”,
可排序:正确
},
{标题:“İrsaliye No”,
宽度:80,
dataIndex:“交货编号”,
可排序:false
},
{标题:“图塔”,
宽度:80,
数据索引:“总计”,
可排序:false
}
],
autoExpandColumn:“表单id”,
renderTo:document.getElementById('form-results'),
宽度:750,
身高:500,
loadMask:是的,
专栏:没错,
插件:rowExpander
});
load();
});
我假设您使用的是ExtJS 3.x,因为您的编码反映了这一点。如果您在extjs3.x中需要帮助,我帮不了您多少,我更习惯于extjs4.x的编码方式,所以我将用它来解释这一点
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
我正致力于实现一个嵌套网格,就像这样,我刚刚经历了以下过程:
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
基本上,您需要使用rowexpander
插件配置主网格,您已经这样做了(下面是我的方式):
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
最后,将脚本写入在行扩展器
插件模板中创建的
标记:
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],
onGridExpandBody : function(rowNode, record, expandbody) {
var targetId = 'SessionInstructionGridRow-' + record.get('ClientSessionId');
if (Ext.getCmp(targetId + "_grid") == null) {
var sessionInstructionGrid = Ext.create('TS.view.client.SessionInstruction', {
renderTo: targetId,
id: targetId + "_grid"
});
rowNode.grid = sessionInstructionGrid;
sessionInstructionGrid.getEl().swallowEvent(['mouseover', 'mousedown', 'click', 'dblclick', 'onRowFocus']);
sessionInstructionGrid.fireEvent("bind", sessionInstructionGrid, { ClientSessionId: record.get('ClientSessionId') });
}
}
阅读:了解更多信息。谢谢,但我目前无法使用Extjs 4.0。因为我应该更改整个代码,抱歉。它的诀窍是定义一个标记,并在事件触发时写入该特定标记。不过,我不知道如何在ExtJS3.0中做到这一点。
plugins: [{
ptype: "rowexpander",
rowBodyTpl: ['<div id="SessionInstructionGridRow-{ClientSessionId}" ></div>']
}],