2

I have an ng2-smart-table with a global search filter that interacts with the fields of the table. It work for that columns that doesn't have any rendering. This is my code

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);
    }

And these are my columns

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,
            }

My search works only on the first column, but doesn't on "varianti" and "products". I didn't find anything about this question, do you know a possible solution? thanks

Jamil89
  • 165
  • 3
  • 14

0 Answers0