使用javascript键事件为特定类设置固定高度

问题描述

使用 webix,创建包含组合编辑器的数据表。这些组合有下拉列表,当我们输入任何键时它会被切断。由于这些列表是动态生成的。我想为这个列表分配一些固定的高度。我使用了下面的代码

on:{
   onkeypress:function(){
    $('.webix_popup').css("height","100px");
    $('.webix_list').css("height","100px");
   }
 }

我尝试了上面的代码,但它不适用于所有键,当我从键盘输入 c、d、g、m、n、p、q 键时它起作用。 我没有得到这些行为。请问谁能告诉我解决办法。

解决方法

要定义固定高度,可以在suggest属性中设置(只需使用Webix config,无需使用JQuery):

{
    view:"datatable",columns:[
      { id:"year",editor:"combo",collection:years,suggest:{
         height:100,body:{
           autoheight:false
         }
       },header:"Released",width:100},{ id:"votes",editor:"text",header:"Votes",width:100}
    ],editable:true,// ...
}

https://snippet.webix.com/v2kkyacx