2011-09-05 4 views
0

중첩 목록의 첫 번째 수준에 자식 리프를 표시 할 수 있는지 알고 싶습니다.Sencha Touch : 한 단계의 중첩 목록?

예를 들어, "내 CATEGORY"(마지막 항목)을 선택할 때 페이지를 표시하고 싶지만 getDetailCard 함수를 사용하면 부모 문제가 있습니다. 메시지는 다음

DATA "를 '정의는'('parent.attributes.record.data'를 평가) 객체가 아닌"

var data = { 
text: 'Groceries', 
items: [{ 
    text: 'WATER', 
    items: [{ 
     text: 'Water', 
     items: [{ 
      text: 'Sparkling', 
      info : 'THIS TEXT IS SHOWN IN THE CHILD LEAF', 
      leaf: true 
     },{ 
      text: 'Still', 
      leaf: true 
     }] 
    },{ 
     text: 'Coffee', 
     leaf: true 
    },{ 
     text: 'Espresso', 
     leaf: true 
    },{ 
     text: 'Redbull', 
     leaf: true 
    },{ 
     text: 'Coke', 
     leaf: true 
    },{ 
     text: 'Diet Coke', 
     leaf: true 
    }] 
}],{ 
    text: 'Fruit', 
    items: [{ 
     text: 'Bananas', 
     leaf: true 
    },{ 
     text: 'Lemon', 
     leaf: true 
    }] 
},{ 
    text: 'Snacks', 
    items: [{ 
     text: 'Nuts', 
     leaf: true 
    },{ 
     text: 'Pretzels', 
     leaf: true 
    },{ 
     text: 'Wasabi Peas', 
     leaf: true 
    }] 
},{ 
    text: 'My Category', 
    info : 'TEXT I WANT TO SHOW ON A CHILD LEAF', 
    leaf: true 
}] 
}; 

MODEL & STORE :

Ext.regModel('ListItem', { 
fields: [ 

{name: 'text', type: 'string'}, 
{name: 'info', type: 'string'} 

] 
}); 

var store = new Ext.data.TreeStore({ 
model: 'ListItem', 
root: data, 
proxy: { 
    type: 'ajax', 
    reader: { 
     type: 'tree', 
     root: 'items' 
    } 
} 
}); 

도움을 주셔서 감사합니다. 안부.

답변

0

잎이 '어린이 잎에 표시하고 싶습니다'는 부모가 없습니다 (실제로는 부모가 나무의 루트 요소입니다).