IE兼容模式下的select2问题IE = EmulateIE7

时间:2018-11-29 17:41:54

标签: jquery asp.net-mvc jquery-select2

您好,根据我的要求,我已经使用了select2控件,但一切正常,但是当我具有如下所示的meta标签时,我无法在IE中使它正常工作

<meta http-equiv="x-ua-compatible" content="IE=EmulateIE7" />

这是我在asp.net应用程序中尝试的代码

function mockData1() {
  var dict = [];
  var buttonarray = {
    "0": "xpumk",
    "1": "cguje",
    "2": "frinr",
    "3": "gezjp",
    "4": "sqjvw",
    "5": "xstra",
    "6": "ecadf",
    "7": "uyzet",
    "8": "nqbvs",
    "9": "dckkp",
    "10": "vqyzu",
    "11": "gfyqn",
    "12": "jncjz",
    "13": "crfiw",
    "14": "ievpb",
    "15": "bpncs",
    "16": "uhibe",
    "17": "oeajy",
    "18": "ozjrj",
    "19": "aoswq",
    "20": "mxbnh",
    "21": "quixs",
    "22": "rswys",
    "23": "beael",
    "24": "yqvki",
    "25": "ivdgb",
    "26": "nwrmg",
    "27": "xgvun",
    "28": "tvdqg",
    "29": "wdlzh"
  };

  for (var key in buttonarray) {
    dict.push({
      id: key,
      text: buttonarray[key]
    });
  }
  return dict;
}

$('#ddlLag1').select2({
  width: '50%',
  data: mockData1(),
  //placeholder: 'search',
  multiple: false,
  // query with pagination
  query: function(q) {
    var pageSize,
      results,
      that = this;
    pageSize = 20; // or whatever pagesize
    results = [];
    if (q.term && q.term !== '') {
      // HEADS UP; for the _.filter function i use underscore (actually lo-dash) here
      results = _.filter(that.data, function(e) {
        if (e.text != undefined) {
          return e.text.indexOf(q.term) >= 0;
        }
      });
    } else if (q.term === '' || q.term === undefined) {
      results = that.data;
    }
    q.callback({
      results: results.slice((q.page - 1) * pageSize, q.page * pageSize),
      more: results.length >= q.page * pageSize,
    });
  },
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.css" rel="stylesheet"/>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.5.4/select2.min.js"></script>
<input type='text' id='ddlLag1' Width="100%" />

因此,如何在选定的兼容模式下在IE中进行相同的操作。如果没有,还有其他替代方法

0 个答案:

没有答案