欧美亚洲中文,在线国自产视频,欧洲一区在线观看视频,亚洲综合中文字幕在线观看

      1. <dfn id="rfwes"></dfn>
          <object id="rfwes"></object>
        1. 站長資訊網(wǎng)
          最全最豐富的資訊網(wǎng)站

          Knockoutjs+select2 人員搜索功能代碼分享

          HTML:

          <select class="form-control PersonEmail" id="txtProjectManager" data-bind="options:{text:ICVInfo.ProjectManager,value:ICVInfo.ProjectManager},optionsText:'text',optionsValue:'value',value:ICVInfo.ProjectManager" ></select>

          javascript:

          $('.PersonEmail').select2({
          "separator": ",",
          "maximumSelectionSize": 10,
          "placeholder": "請選擇用戶",
          "allowClear": false,
          "maximumInputLength": 100,
          "minimumResultsForSearch": "2",
          "tags": false,
          templateResult: function (repo) {
          markup = repo.text;
          return markup;
          },
          escapeMarkup: function (markup) { return markup; },
          templateSelection: function (repo) {
          return repo.text;
          },

          ajax: {
          @*url: '@Url.Action("SelectUser", "CommercialReminder")', dataType: 'json', data: function (params) {*@
          url: 'SelectUser',
          dataType: 'json',
          delay: 250,
          data: function (params) {
          return {
          q: params.term, // search term
          page: params.page
          };
          },
          processResults: function (data, params) {
          params.page = params.page || 1;

          return {
          results: data.items,
          pagination: {
          more: (params.page * 30) < data.total_count
          }
          };
          },
          cache: false,
          type: 'post'
          },
          initSelection: function (element, callback) {
          if (element.val() != null) {
          var data = { id: element.val(), text: element.val() };
          //alert(data.id);
          callback(data); //這里初始化
          }
          }
          })

          目前只適合單選,多選目前還在配置,等測試通過后會繼續(xù)放上來。

          贊(0)
          分享到: 更多 (0)
          網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號