0

我想让我的表格行在 sencha touch 中可点击,这可能吗?我现在正在使用 onclick,但似乎不起作用......我想让 tr 带有可点击的位置,以防你没有看到。

Ext.define('android.view.EventDetail', {
    extend: 'Ext.Panel',
    xtype: 'eventdetail',
    requires: [
        'android.store.Eventstore',
       'android.store.Placesstore',
    ],

    config: {
        fullscreen: 'true',
        title: 'Details',
        styleHtmlContent: true,
        scrollable: 'vertical',
        style: 'background-color: #FFF',



        tpl: [
            '<div class="detail"><table width="100%" class="bottomBorder"><tr><td><div class="imglist"><img src="http://admin.hishanghai.info/{picture}" width="120" height="120"></div><div class="title">{name}</div><div class="description">{description}</div></td></tr><tr><td><b>When:</b> {[this.timestart(values.time_start)]}</td></tr><tr onclick="goPlaces(values.id_place);"><td><b>Where:</b> {[this.showPlace(values.id_place)]}</td></tr><tr><td><b>Share</b></td></tr><tr><td><b>Link:</b> <a href="http://{website}">{website}</a></td></tr><tr><td><b>Phone:</b> {phone}</td></tr></table></div><div class="promote">Promote your own Event on HiShanghai</div>',
             {
             compiled: true,

             showPlace: function(id_place){
                var placesstore = Ext.getStore('Placesstore');
                var i =0;
                var placeid = 0;
                var aRecord;
                while(placeid != id_place){
                    aRecord = placesstore.getAt(i);
                    placeid = aRecord.data.id;
                    i+=1;
                    }
                var naam = aRecord.data.name;
                return naam;
                 },


             }
        ],

        //record: null
    },


});
4

1 回答 1

0

找到了,贴在这里给别人。你让你的 tr 可点击

tpl: [<tr onclick="goPlaces({id_place})">]

然后转到您的 index.html 并制作函数

<script>
   function goPlaces(plid){
            ... code here ...
             }
</script>

另请查看http://www.sencha.com/forum/showthread.php?260146-Tpl-table-on-click-show-other-js&p=953213#post953213

于 2013-04-02T02:22:26.693 回答