按下移动列表项和longtap事件

时间:2016-07-05 04:25:24

标签: mobile qooxdoo

在这个小qooxdo移动示例中,我需要知道触发longtap时按下的列表项。我怎么知道?

var page = new qx.ui.mobile.page.NavigationPage();
page.setTitle("List");
page.addListener("initialize", function() {
  var list = new qx.ui.mobile.list.List({
    configureItem : function(item, data, row) {
      item.setTitle(data.title);
      item.setSubtitle(data.subTitle);
      item.setSelectable(true);
      item.setShowArrow(true);
    }
  });

  var data = [];
  for (var i=0; i < 50; i++) {
    data.push({title:"Item" + i, subTitle:"Subtitle for Item #" + i});
  }

  list.setModel(new qx.data.Array(data));
  list.addListener("changeSelection", function(evt) {
    alert("Item Selected #" + evt.getData());
  }, this);

  list.addListener("longtap", function(evt) {

      // <--- HERE I NEED KNOW THE LIST ITEM PRESSED

  }, this);

  page.getContent().add(list);
},this);

this.getManager().addDetail(page);

page.show();

我需要一些帮助。感谢

1 个答案:

答案 0 :(得分:1)

解决方案:

DATA = [[/osha/,    'Creating OSHA Regional email..',                :osha_reg],
        [/pend/,    'Creating 6 day hold pending email..',           :pend],
        [/60/,      'Creating 60 day hold account deletion email..', :sixty_day],
        [/generic/, 'Creating generic email..',                      :generic],
        [/resolve/, 'Creating resolution ticket..',                  :resolve],
        [/esc/,     'Creating escalation ticket..',                  :assign],
        [/pii/,     'Creating request to remove personal info..',    :remove_pii],
        [/vip/,     'Creating VIP user email..',                     :vip_user],
        [/inop/,    'Creating INOP user email..',                    :in_op_user]]

def gather_intel
  type = OPTIONS[:type]
  regex, msg, email = DATA.find { |r,*_| type =~ r }
  if regex
    FORMAT.send :info, msg
    EMAILS.send email
  elsif type =~ /dev/ 
    message = type.to_s.include?('dev=unlock') ? 'unlock' : 'password reset'
    FORMAT.info("Creating dev account #{message} email")
    EMAILS.dev_account(type)
  else
    raise ERROR
  end
end