我有一个关于在Netzke Grid中过滤数据的问题。
column :user_id do |c|
c.editor = {xtype: :combobox, editable: false, min_chars: 2}
end文档中提到,将覆盖自动编辑器配置的哈希。例如,对于一对多关联列,您可以将其设置为{min_chars: 1},它将被传递到组合框,并使其在输入1个字符(而不是默认的4个字符)后查询其远程数据。
看起来{min_chars: 1}并没有像预期的那样工作。
发布于 2013-07-21 18:55:30
请看下面的例子简单的客户网格,让我知道它是否适合你。Netzke的方法是使用__ (双下划线)来定义一对多关联。这为您提供了combobox和所有必要的数据绑定。我尝试了不同的方法来使min_chars属性工作,但都失败了。可能是个窃听器。最后,唯一有效的方法是使用init_component方法。
class Customers < Netzke::Basepack::Grid
def configure(c)
super
c.model = 'Customer'
c.columns = [
{ name: :name, header: 'Customer Name' },
{ id: :country__name, name: :country__name, header: 'Country' }
]
end
js_configure do |c|
c.init_component = <<-JS
function() {
this.callParent();
Ext.ComponentManager.get('country__name').editor.minChars = 2;
}
JS
end
endhttps://stackoverflow.com/questions/17738962
复制相似问题