2

我有一个带有全局搜索过滤器的 ng2-smart-table,它与表的字段交互。它适用于没有任何渲染的列。这是我的代码

onSearch(query: string = '') {
        if(query != ""){
            this.pages.setFilter(
            [
            // fields we want to include in the search
                {
                field: 'productTypeDescription',
                search: query
                },
                {
                field: 'products',
                search: query
                },
                {
                field: 'varianti',
                search: query
                }
        ], false);
    }

这些是我的专栏

productTypeDescription: {
                title: 'Tipo prodotto',
                filter: false,
                class: "colonneTabella",
                width: "20%",
            },
            products: {
                title: 'Prodotto',
                filter: false,
                class: "colonneTabella",
                width: "20%",
                valuePrepareFunction: (products) => { 
                    var output ="";
                    var outputs = "";

                    products.forEach(function(item){
                        output = item.productDescription
                        item.variantList.forEach(function(el){
                            outputs= output;  
                        })   


                    })
                    console.log(outputs)
                    return outputs;  

                    //return JSON.stringify(value)}
                }
            },

            varianti: {
                title: 'Varianti',
                filter: false,
                class: "colonneTabella",
                type: 'custom',
                width: "20%",
                renderComponent: VariantsProductRenderComponent,
            }

我的搜索仅适用于第一列,但不适用于“varianti”和“products”。我没有找到有关此问题的任何信息,您知道可能的解决方案吗?谢谢

4

0 回答 0