1. #1
    Sencha User
    Join Date
    Jun 2012
    Posts
    1
    Vote Rating
    0
    gld2000 is on a distinguished road

      0  

    Default Unanswered: sencha nestedlist itemtap. Please help me. Koreans.

    Unanswered: sencha nestedlist itemtap. Please help me. Koreans.


    Please look for my own code.

    Click on the photo I'd like to float when the alarm alert.

    {
    text:'photo',
    //leaf:true
    items:[] <= Look at this part, item value is not present, an error form.

    }

    If you do not do pop up alert by the item value
    I do not want a item value.
    How should I modify?

    HTML Code:
     var data={
                 text:'카페',
                 items:[
          {
                        text:'처음', leaf:true             
        },{
                        text:'음료',
                        items:[{
                               text:'물',
                               items:[{
                                     text:'탄산수',
                                     leaf:true
                               },{
                                     text:'생수',
                                     leaf:true
                               }]
                        },{
                               text:'아메리카노',
                               leaf:true
                        },{
                               text:'에스프레소',
                               leaf:true
                        },{
                               text:'카푸치노',
                               leaf:true
                        }]
                 },{
                        text:'케이크',
                        items:[{
                               text:'치즈 케이크',
                               leaf:true
                        },{
                               text:'블루베리 케이크',
                               leaf:true
                        }]
                 },{
                        text:'photo', 
         //leaf:true
         items:[]
                                    
        }   
        
                       ]
    };
     
    Ext.regModel('ListItem',{
           fields:[    
         {name:'text',type:'string'},   
        ]
    });
     
    var store=new Ext.data.TreeStore({
           model:'ListItem',
           root:data,
           proxy:{
                 type:'ajax',
                 reader:{
                        type:'tree',
                        root:'items'
                 }
           }
                 
    });
     
     
     Ext.setup({
     tabletStartupScreen: 'tstart.png',
       phoneStartupScreen: 'pstart.png',
        icon: 'icon.png',
        glossOnIcon: false,
        onReady: function() {
                 var listPanel;
                 
                 listPanel= new Ext.NestedList({
                        fullscreen:true,
                        title:'List',
                        displayField : 'text',
                        store:store,
         
         
         
       
                   
                        getDetailCard:function(item, parent){
             var itemData = item.attributes.record.data,
             parentData = parent.attributes.record.data,
                               detailCard = new Ext.Panel({
              scroll:'vertical',
              styleHtmlContent:true,
           //  items: [{xtype:"button",text:"ddd"}],
                                     tpl : ["{text}", "<br>", "{text}"]
               
                               });
                               detailCard.update(itemData);
             this.backButton.setText(parentData.text); 
                               return detailCard;
                        },
         
      listeners: {
      itemtap:function(list, index, item, e){
    var currentRecord = list.getStore().getAt(index);     
    currentRecord.text      = currentRecord.get('text');    
    
      if(currentRecord.text=="photo") {
       Ext.Msg.alert("알람","photo", Ext.emptyFn);
      }
      }
      },
         
         
         
         getItemTextTpl: function(){
          var tplConstructor = '{text}'+
          '<tpl if="text === \'처음\'">'+
          '<div class="metadata">'+
          '<b>사진 넣기</b>'+
          '</div>'+'</tpl>'+      
               
               
          '<tpl if="text === \'물\'">'+
          '<div class="metadata">'+
          '마시는 것'+
          '</div>'+'</tpl>'+
          '<tpl if="text === \'카푸치노\'">'+
          '<div class="metadata">'+
          '빵종류'+
          '</div>'+'</tpl>';
          
          return tplConstructor;
         }
          
                 });
     
                 
    
           
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    St. Louis, MO
    Posts
    34,121
    Vote Rating
    453
    Answers
    3160
    mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of mitchellsimoens has much to be proud of

      0  

    Default


    Are you wanting the photo node to be a leaf so it has no child items?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    http://www.JSONPLint.com - Source to lint your JSONP!

    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is almost in print!

    When posting code, please use BBCode's CODE tags.

Tags for this Thread