开发者

Sencha Touch: Disclosure on single item

开发者 https://www.devze.com 2023-04-11 14:02 出处:网络
I have a normal list in Sencha Touch. Now I need to mark a single item in that list as a \"disclosure\" item.

I have a normal list in Sencha Touch. Now I need to mark a single item in that list as a "disclosure" item.

The functionality should be sth like this:

onItemDisclosure: function(record) {
    if (record.data.type != "link") return false; //not a disclosure
    return t开发者_运维知识库rue;  //disclosure item
}

Is this possible to achieve?


Try this:

new Ext.List({
    onItemDisclosure:true,
    store:'Events',
    itemTpl:'{date} {name}',
    listeners:{
        afterrender:function(cmp){
            this.store.each(function(record,index,itemsCount){
                if(record.data.type != "link"){
                    Ext.select('.x-list-disclosure',cmp.getNode(index)).remove();
                }
            });                         
        },
        itemtap:function(list,index,item){
            var record = this.store.getAt(index);
            if(record.data.type == "link"){
                // do action
            }               
        }
    }
})
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号