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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

using different filtercolumn in "this.filterColumn" ejgrid

Thread ID:

Created:

Updated:

Platform:

Replies:

127857 Dec 14,2016 01:55 AM UTC Dec 14,2016 01:26 PM UTC JavaScript 1
loading
Tags: ejGrid
Satheesh Kumar
Asked On December 14, 2016 01:55 AM UTC

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?



Prasanna Kumar Viswanathan [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;