We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

using different filtercolumn in "this.filterColumn" ejgrid

I'm binding a datasource to a grid with a field "process". The datasource also contains Id column for the corresponding process column which is not displayed.

The grid has a  filterbar template which displays ejDropdown for the same process column from remote datasource which returns distinct of process names with id. Below is the JS code  

{field: 'process',filterBarTemplate: { write: function (args) {args.element.ejDropDownList({ width: '100%', showPopupButton: true, dataSource: ej.DataManager({ url: '/GetData/Process', adaptor: new ej.UrlAdaptor()}),fields:{text: 'value',value: 'id'},change: ej.proxy(args.column.filterBarTemplate.read, this, args) })},read: function(args) {console.log(args);if (args.element.val() == '0') {this.clearFiltering(args.column.field);args.element.val('')}this.filterColumn(args.column.field , 'equal',args.element.val(), 'and', true); }, },headerText: 'Process',headerTextAlign: 'center'}


On dropdown selection the (Syncfusion.JavaScript.DataManager dm) parameter gives the bound column name(process) in dm.Where.Field. I want to know is there way to specify different filter column? I tried adding "this.filterColumn(args.column.field + id" )" but the dropdown selection is not working on first click it works on second click or after clearing.

Any idea? or is it a bug?



1 Reply

PK Prasanna Kumar Viswanathan Syncfusion Team December 14, 2016 01:26 PM UTC

Hi Satheesh, 

Thanks for contacting Syncfusion support. 

According to your query, we suspect that while filter the process column you also need to filter the corresponding Id column with the same value.  In read method of filter bar template we used filtercolumn method to filter the particular column. In filter column we can also pass array of filterColumn query for performing filter operation. 

Find the code example: 


$(function () { 
         var dataManager = ej.DataManager({ 
             url: "/Grid/DataSource", 
             adaptor: new ej.UrlAdaptor() 
         }); 
            $("#Grid").ejGrid({ 
                dataSource: dataManager, 
                ----------------------------- 
                columns: [ 
                        --------------------------------------------- 
                        { 
                        field: "EmployeeID", width: 100, filterBarTemplate: { 
                          write: function (args) { args.element.ejDropDownList({ width: '100%', showPopupButton: true, dataSource: ej.DataManager({ url: '/Grid/Process', adaptor: new ej.UrlAdaptor()}),change: ej.proxy(args.column.filterBarTemplate.read, this, args) }) }, 
                             --------------------------------- 
                                this.filterColumn([{ field : args.column.field, operator :"equal", value : args.element.val(), matchcase : true },{ field : "CustomerID", operator :"equal", value : "ALFKI", matchcase : true }]) 
                                     }, 
                                 } 
                             }, 
                        --------------------------------------- 
                ] 
            }); 
        }); 

For more information refer the below help document. 


Regards, 
Prasanna Kumar N.S.V 


Loader.
Up arrow icon