2012-05-08 16 views
5

कोई भी जानता है कि आप ExtJS में किसी भी क्षेत्र के उप-क्षेत्र कैसे मॉडल करते हैं? उदाहरण के लिएSubfields के साथ Extzs मॉडल फ़ील्ड्स

Ext.data.Model:

fields:[ 
    {name: 'id', type: 'int'}, 
    {name: 'title', type: 'string'}, 
    {name: 'description', type: 'string'}, 
    {name: 'priority', type: 'auto', fields:[ 
     {name: 'code', type: 'string'} 
    ]}, 
    {name: 'createdBy', type: 'auto'}, 
] 
मेरी ग्रिड पैनल में

तो

Ext.grid.Panel

columns:[ 
    {header:'Title', dataIndex:'title', flex:1}, 
    {header:'Priority', dataIndex:'code'} 
], 

किसी भी विचार कैसे मैं dataIndex 'कोड' का उपयोग 'प्राथमिकता' के तहत? अग्रिम में धन्यवाद!

+0

जरूरत यहाँ आप कर सकते हैं है एक समान प्रश्न के लिए मेरा उदाहरण देखें: http://stackoverflow.co एम/ए/12694550/14 9 6088 –

उत्तर

11

@sha के लिए धन्यवाद - यहाँ जवाब मैं :)

मॉडल

fields:[ 

      {name: 'id', type: 'int'}, 
      {name: 'title', type: 'string'}, 
      {name: 'description', type: 'string'}, 
      {name: 'priority', type: 'auto'}, 
      {name: 'code', type: 'string', mapping:'priority.code'}, 
      {name: 'createdBy', type: 'auto'}, 

     ] 

बांधना पैनल

columns:[ 

      {header:'Title', dataIndex:'title', flex:1}, 
      {header:'Description', dataIndex:'description'}, 
      {header:'Priority', dataIndex:'code'} 

     ], 
4

इस प्रयास करें:

dataIndex: 'priority.code' 
+0

हाँ जो मैंने सोचा था। मेरे लिए काम नहीं किया :( – Stevanicus

+3

क्या आप अपने JSON/XML डेटा स्रोत से नेस्टेड जानकारी से स्केलर फ़ील्ड प्राप्त करने के लिए मॉडल की 'मैपिंग' सुविधा का उपयोग कर सकते हैं? – sha

+0

इसके लिए धन्यवाद ... मानचित्रण एक बार फिर महत्वपूर्ण है ... खराब दस्तावेज :) – Stevanicus