0
我正在使用ExtJS和XMLReader在GridPanel中顯示內容。這工作得很好,但是我的XML源具有重複元素的不可預知號碼:在ExtJS網格中處理不可預知的XML數據
<beamline>
<technique>Tomography</technique>
<technique>Phase contrast imaging</technique>
<technique>Microdiffraction</technique>
<technique>General diffraction</technique>
</beamline>
有可能是任何地方從0-30 <technique>
元素。
目前我手動XMLReader可以使用這些拉出:第n個(n)的選項:
{name: 'technique1', mapping: 'technique:nth(1)'},
{name: 'technique2', mapping: 'technique:nth(2)'},
,然後在面板爲列將這些並用渲染功能級聯:
{header: "Technique", width: 100, dataIndex: 'technique1', sortable: false, renderer: techniques},
{header: "Technique2", dataIndex: 'discipline2', hidden: true},
function techniques(val, x, store){
return '<ul><li>'+val+'</li><li>'+store.data.technique2+'</li></ul>';
}
但這顯然太笨重,無法擴展。是否有一個通用的(循環或XPath風格)方法來實現類似的結果?
謝謝,DanB,我會放棄它。 – Jonas 2010-12-03 04:26:38