私は次の店を持っています:
var dnrListStore = new Ext.data.ArrayStore({
fields: [
{name: 'SUBSYS_ART_NR', type: 'int'},
{name: 'ART_DESC', type: 'string'},
{name: 'SORTEN_TEXT', type: 'auto'},
{name: 'VAR', type: 'int'},
{name: 'GEBI', type: 'int'},
{name: 'DNR_ID', type: 'int'},
{name: 'STATUS', type: 'int'},
{name: 'LEVEL0', type: 'float'},
{name: 'VALUE0', type: 'float'},
{name: 'LEVEL1', type: 'float'},
{name: 'VALUE1', type: 'float'},
{name: 'LEVEL3', type: 'float'},
{name: 'VALUE3', type: 'float'}
],
data: dnrList
});
一部の列 ( LEVELX および VALUEX ) はnull
、従業員が入力した値が原因である可能性があります。したがって、値を使用できない列を非表示にしたいと思います。checkValue
関数は適切に機能し、正しい値を返します。以下を試しましたが、何も起こりません。
var checkValue = function(arg) {
var v = {};
for (var i = 0; i < dnrList.length; i++) {
v[i] = dnrList[i].data;
}
for (var key in v) {
if (v[key].hasOwnProperty(arg)) {
return true
} else {
return false
}
}
}
// on grid columns definition
columns: [
{text: 'LEVEL 1', dataIndex: 'LEVEL1', hidden: checkValue("LEVEL1")}
]
// or
columns: [
{text: 'LEVEL 1', dataIndex: 'LEVEL1', hidden: (checkValue("LEVEL1") ? true : false)}
]
私たちがそれをどのように行うか分かりますか?
別
の方法 この方法では、タスクを達成できますが、実現可能ではありません!
columns:[
{
text: 'LEVEL 1', dataIndex: 'LEVEL1',
renderer: function(val, meta, rec, row, col) {
if (val == null) {
Ext.getCmp('summary-grid').headerCt.remove(col);
} else {
return rec.get('LEVEL1')
}
}
}
]