无法搜索网格中的切换列

时间:2018-07-18 11:12:38

标签: w2ui

当我通过搜索将切换列添加到网格中时,它似乎不起作用。我用搜索演示修改了网格以包括一个切换。但是,当我尝试对其进行搜索时,下拉列表仅为我提供了“是”选项,并且我无法为搜索子句输入任何内容。

searches: [
    { field: 'recid', caption: 'ID ', type: 'int' },
    { field: 'lname', caption: 'Last Name', type: 'text' },
    { field: 'fname', caption: 'First Name', type: 'text' },
    { field: 'email', caption: 'Email', type: 'list', options: { items: ['peter@gmail.com', 'jim@gmail.com', 'jdoe@gmail.com']} },
    { field: 'auth', caption: 'Auth', type: 'toggle' }
],
columns: [                
    { field: 'recid', caption: 'ID', size: '50px', sortable: true, attr: 'align=center' },
    { field: 'lname', caption: 'Last Name', size: '30%', sortable: true },
    { field: 'fname', caption: 'First Name', size: '31%', sortable: true },
    { field: 'email', caption: 'Email', size: '40%' },
    { field: 'auth', caption: 'Auth', render: 'toggle', size: '20px' }
]

jsFiddle:https://jsfiddle.net/c9r6pk7m/4/

1 个答案:

答案 0 :(得分:1)

虽然SELECT DISTINCT是有效的呈现值,但它不是有效的搜索类型。

请参阅:http://w2ui.com/web/docs/1.5/w2grid.searches

您可以使用toggle来代替,尽管我必须承认,我必须通过将list值映射到false来“欺骗”。

{id:"0", text: "No"}

https://jsfiddle.net/c9r6pk7m/9/