ExtJS 4.1.1:使用TreeGrid/TreeStore
我的代码有一些问题,我希望你能帮我解决,因为我遇到了麻烦 我在树状网格中有一个字段,该字段具有以下属性:ExtJS 4.1.1:使用TreeGrid/TreeStore,extjs,extjs4,extjs4.1,treegrid,Extjs,Extjs4,Extjs4.1,Treegrid,我的代码有一些问题,我希望你能帮我解决,因为我遇到了麻烦 我在树状网格中有一个字段,该字段具有以下属性: xtype : 'gridcolumn', id : 'raGridFormulaLink_Purchased', dataIndex: 'formulaLink', groupable : false, editor : { xtype: 'textfield' }, renderer: function(
xtype : 'gridcolumn',
id : 'raGridFormulaLink_Purchased',
dataIndex: 'formulaLink',
groupable : false,
editor : {
xtype: 'textfield'
},
renderer: function(value, metaData, record, rowIndex, colIndex, store) {
var rVal; var linkRec;
if(value !== '' && value !== 0) {
/* TODO Find linked Record based on ['child_id' => value]
* and print that record's [text] to rVal */
rVal = Ext.local.langstore[448] + ' ' + value;
}
return rVal;
},
align: 'left',
width: 100
正如你所看到的,我正在尝试做一个简单的HLOOKUP来查找链接的记录。但是我无法从商店得到正确的记录。我该怎么做
该值具有正确的“child_id”,因此不是输入错误
感谢您的帮助
GR.解决了这个问题
最终代码:
renderer: function(value, metaData, record, rowIndex, colIndex, store) {
var rVal; var rText = ''; var node;
if(value !== '' && value !== 0) {
if(record.isLeaf()) {
var node = record.parentNode.findChild('child_id',value);
rText = node.data.text;
rVal = Ext.local.langstore[448] + ' ' + rText;
}
}
return rVal;
},
在我看来,您需要对Extjs模型的工作原理进行更多的研究。这段代码对我来说毫无意义,我甚至不知道你在这里具体想做什么。我认为HLOOKUP是一个excel函数,实际上没有一个简单的等价函数Extjs,尽管您可以通过更好地了解Extjs中的存储如何工作来完成一些工作。HLOOKUP是一个excel函数,是的。我只是用它来更好地解释我想要实现的目标。Saki(Sencha支持论坛)建议使用该功能。