简体   繁体   English

slickgrid中的Selectize下拉菜单隐藏在slick网格边界之外。 我怎样才能使它达到最高?

[英]Selectize dropdown within slickgrid is hidden beyond slick grid boundary. How can I make it to come up at top?

I am using selectize to provide inline cell editing in slickgrid. 我正在使用selectizeslickgrid中提供嵌入式单元格编辑。 I am able to load this component within cell. 我能够在单元中加载此组件。 But when dropdown options container pops up and it goes beyond the slickgrid viewport, dropdown options container is getting truncated by slickgrid boundary. 但是,当下拉选项容器弹出并超出slickgrid视口时,下拉选项容器将被slickgrid边界截断。 It should come over the grid. 它应该越过网格。 How can I bring the dropdown options container to the top. 如何将下拉选项容器置于顶部。

var grid;
var columns = [
  { id: 'title', name: 'Title', field: 'title' },
  { id: 'duration', name: 'Duration', field: 'duration' },
  { id: '%', name: '% Complete', field: 'percentComplete' },
  { id: 'start', name: 'Start', field: 'start' },
  { id: 'finish', name: 'Finish', field: 'finish' },
  {
    id: 'effort-driven',
    name: 'Effort Driven',
    field: 'effortDriven',
    editor: IEditor
  },
];

var options = {
  enableCellNavigation: true,
  enableColumnReorder: false,
  editable: true,
  autoHeight: true
};

function IEditor(args) {
  var selectElement = $('<input type="text"/>');
  args.container.append(selectElement[0]);
  selectElement.selectize({
    create: false,
    maxElements: 1,
    options: [
      {
        name: 'A',
        value: 'a'
      },
      {
        name: 'B',
        value: 'b'
      },
      {
        name: 'C',
        value: 'c'
      },
      {
        name: 'D',
        value: 'd'
      },
      {
        name: 'E',
        value: 'e'
      },
      {
        name: 'F',
        value: 'f'
      },
    ],
    labelField: 'name',
    valueField: 'value'
  });

  /*********** REQUIRED METHODS ***********/

  this.destroy = function() {
    // remove all data, events & dom elements created in the constructor
  };

  this.focus = function() {
    // set the focus on the main input control (if any)
  };

  this.isValueChanged = function() {
    // return true if the value(s) being edited by the user has/have been changed
    return false;
  };

  this.serializeValue = function() {
    return '';
  };

  this.loadValue = function(item) {
  };

  this.applyValue = function(item, state) {
  };

  this.validate = function() {
    return { valid: false, msg: 'This field is required' };
  };
}

$(function() {
  var data = [];
  for (var i = 0; i < 3; i++) {
    data[i] = {
      title: 'Task ' + i,
      duration: '5 days',
      percentComplete: Math.round(Math.random() * 100),
      start: '01/01/2009',
      finish: '01/05/2009',
      effortDriven: i % 5 == 0,
    };
  }

  grid = new Slick.Grid('#myGrid', data, columns, options);
  grid.init();
});

I have added selectize drop down in Effort Driven column in this plunker 我已在此插件中的“努力驱动”列中添加了selectize下拉列表

I used to use chosen as my enhanced select but I ran into exactly this problem, and it wasn't solvable due to the HTML it used. 我曾经使用chosen作为我的增强选择,但是我碰到了这个问题,由于它使用了HTML,因此无法解决。 I had to jump ship to Select2 . 我不得不跳船去Select2 There are examples for this here - check out 'Select2 javascript drop-down editor' and 'Select2 Multiselect javascript drop-down editor'. 这有例子在这里 -看看“选择二JavaScript的下拉菜单编辑器”和“选择二多选JavaScript的下拉菜单编辑器”。

Make sure your z-index is bigger than the ones SlickGrid uses. 确保您的z-index大于SlickGrid使用的z-index。 If I remember correctly SlickGrid's highest one was 11 or 12, so with a 13 you should be good to go. 如果我没记错的话,SlickGrid的最高分数是11或12,因此,如果分数为13,您应该就可以了。 Also check the overflow of the cells' css classes; 还检查单元的css类的溢出; it might happen that your context menu is simply cut off. 您的上下文菜单可能会被切断。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使此下拉列表始终显示在父div之外? - How can I make this dropdown always show beyond the parent div? 如何裁剪超出图像边界的图像,就像我想通过添加透明/白色边距从 4:3 图像制作 1:1 图像一样? - How can I crop an image beyond image boundary like I want to make a 1:1 image from a 4:3 image by adding transparent/white margins to it? 如何使SlickGrid标题过滤器出现在网格负载上? - How can I get SlickGrid header filters to appear on grid load? 如何使网格内的 div 超出网格? - How do I make a div inside a grid stretch beyond the grid? 如何在excel中制作滑板键盘导航? - How can i make slickgrid keyboard navigation just like in excel? 如何通过JS API使Google Map标记悬停在顶部? - How can I make Google Map markers “come to top” on hover with the JS API? 如何确定下一张图片不会出现 - How can I make sure my next image wont come up 当用户单击slick-header-menuitem下拉列表时,如何将所有数据放入slickgrid。 - How to get all the data into the slickgrid when user click on the slick-header-menuitem dropdown.? 如何在地图框的边界顶部获取经度? - How can I get lat on the boundary top of mapbox? 当网格上方的内容被隐藏时,如何向上滑动网格? - How do I Slide up the Grid when the content above it is hidden?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM