如何添加ITEM TAP [英] How to add itemtap

查看:15
本文介绍了如何添加ITEM TAP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表,但无法将列表中的项目设置为可点击。我有onItemDiscount,它应该可以工作,但它不能。我希望整排都是可点击的,但我似乎无法让任何东西正常工作。

    onItemDisclosure : function(record, btn, index) {
        //window.location = 'http://www.google.com';
    }

这是我的完整源代码

    Ext.ns("Course", "Course.stores");

Course = new Ext.Application({
  defaultTarget : 'viewport',
  name : 'Course',
  launch : function() {
    console.log('begin');

    this.viewport = new Ext.Panel({
      fullscreen : true,
      dockedItems : [ {
        title : 'Course Catalog',
        xtype : 'toolbar',
        ui : 'light',
        dock : 'top'
      } ],
      layout : 'fit',
      scroll : 'vertical',
      items : [ {
        xtype : 'list',
        itemTpl : '<span id="{letter}">{course}</span>',
        store : Course.stores.Properties,
        singleSelect : true,

        itemSelector : 'span.id',
        onItemDisclosure : function(record, btn, index) {
            //window.location = 'http://www.google.com';
        }
      } ],
      flex : 1
    });

  }
});

Ext.regModel('Properties', {
  fields : [ {
    name : 'letter',
    type : 'string'
  }, {
    name : 'course',
    type : 'string'
  } ]
});

Course.stores.Properties = new Ext.data.Store({
  model : 'Properties',  
  sorters: 'letter',
  getGroupString : function(record) {
        return record.get('letter')[0];
  },
  proxy : {
    type : 'ajax',
    url : '../lib/course_catalog.php',
    reader : {
      type : 'json',
    }
  },
  autoLoad : true
});

推荐答案

尝试如下:

items : [ {
    xtype : 'list',
    itemTpl : '<span id="{letter}">{course}</span>',
    store : Course.stores.Properties,
    listeners: {
        scope : this,
        itemtap : function(foo, bar, etc) {
            doSomething...
        }
  } ],

这篇关于如何添加ITEM TAP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆