[英]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. 我正在使用selectize在slickgrid中提供嵌入式单元格编辑。 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.