【问题标题】:Force DropDownList to use list instead of ActionSheet for mobile强制 DropDownList 使用列表而不是移动设备的 ActionSheet
【发布时间】:2013-08-31 16:50:30
【问题描述】:

我正在使用 Kendo 开发一个 iPad 应用程序,而 DropDownList 正在抛出一个 ActionSheet。我想强制它使用 Web UI 列表样式。我该怎么做?

【问题讨论】:

    标签: kendo-ui kendo-mobile


    【解决方案1】:

    对于任何感兴趣的人,我都能够拼凑出一个解决方案。这是一个接受 kendoMobileView 作为参数并应用修复的函数。

    //Hack to force dropdowns to act like comboboxes in mobile!
    	utils.fix.dropdownlists = function(view) {
          var dropdowns = view.element.find("[data-role='dropdownlist']");
          //Iterate through dropdown elements
          _.each(dropdowns, function(item){
            var comp = $(item).data("kendoDropDownList");
            if(comp && comp.popup) {
              comp.popup.bind("open", function(event){
                event.sender.element.parent().removeClass("km-popup km-widget");
                if(event.sender.element.parent().hasClass("km-popup")) {
                  //Prevent default open animation.
                  //Then remove classes and open the popup programitcally
                  //Easy peasy, Lemon squeezy
                  event.preventDefault();
                  event.sender.element.parent().removeClass("km-popup km-widget");
                  setTimeout(function(){
                    event.sender.open();
                  },0);
                }
              });
            }
          });
    	}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-15
      • 2014-07-14
      • 2014-12-27
      • 2011-06-12
      • 1970-01-01
      • 2015-10-19
      • 2021-06-26
      • 2012-11-30
      相关资源
      最近更新 更多