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
close icon

What does Match in Custom Filter actually do?

Hi,

I am trying to build my own converter to convert the filter into sql syntax. Can I know what is the logic behind the filter compare operator of "Match" in the custom filter dialog?

Besides that, is that any easy way that I can retrieve the filtered result from GGC into datatable?



Attachment: Capture_8905e3df.zip

6 Replies

SI Silambarasan I Syncfusion Team November 5, 2014 01:02 PM UTC

Hi Chong,

 

Thank you for using Syncfusion Products.

 

Query #1 “Can I know what is the logic behind the filter compare operator of "Match" in the custom filter dialog?”

 

We have forwarded this query to the development team and we will update you the further details on November 7, 2014.

 

Query #2 “is that any easy way that I can retrieve the filtered result from GGC into datatable?”

 

We would like to let you know that your requirement (“To retrieve the filtered result from GGC into DataTable”) can be achieved by using PreRender event.  Please refer the below code snippets.

 

CODE SNIPPET:

 

[ASPX.CS]

 

protected void Page_Load(object sender, EventArgs e)

{

if (!IsPostBack)

{

//Bind data to GridGroupingControl.

GetData();

}

this.GridGroupingControl1.PreRender += GridGroupingControl1_PreRender;

}

 

void GridGroupingControl1_PreRender(object sender, EventArgs e)

{

if (((GridGroupingControl)sender).TableDescriptor.RecordFilters.Count != 0)

{

DataTable filteredData = GetFilterData((GridGroupingControl)sender);

}

}

 

private DataTable GetFilterData(GridGroupingControl gridGroupingControl)

{

DataTable filteredData = new DataTable();

 

foreach (var tableColumn in gridGroupingControl.TableDescriptor.Columns)

{

filteredData.Columns.Add(tableColumn.ToString());

}

 

foreach (var rows in gridGroupingControl.CurrentTable.FilteredRecords)

{

Record row = rows.GetRecord();

DataRow dr = filteredData.NewRow();

for (int i = 0; i < row.ParentTableDescriptor.ItemProperties.Count; i++)

{

dr[row.ParentTableDescriptor.ItemProperties[i].Name] = row.GetValue(row.ParentTableDescriptor.ItemProperties[i].Name);

}

filteredData.Rows.Add(dr);

}

 

return filteredData;

}

 

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

 

Link: SampleProject.zip

 

Please let us know if you need any further assistance.

 

Regards,

Silambarasan I



SI Silambarasan I Syncfusion Team November 7, 2014 11:07 AM UTC

Hi Chong,

 

Thanks for your patience.

 

We have analyzed your query ("what is the logic behind the filter compare operator of "Match" in the custom filter dialog?”) and we would like to let you know that we are using “Regular Expression” to do filtering by comparing ‘MATCH’ case in Custom filter dialog.  

 

For example let us look at the following scenario:

 

1.       1. Let us filter column A with some filter value.

2.       2. We are using Regular expression (Regex Class) for filtering. The value we have entered is passed to Regex.IsMatch () method. (eg: Regex(“Column Value”).IsMatch(“Filter value”);)

3.       3. If the result is true, the column is filtered and the appropriate records are pushed into a stack. Then the pushed records are displayed in the grid.

 

For more information, please refer the following links.

 

Link 1: http://help.syncfusion.com/ug/windows%20forms/default.htm#!documents/filters.htm

 

Link 2: http://msdn.microsoft.com/en-us/library/3y21t6y4%28v=vs.110%29.aspx

 

Please let us know if you need any further assistance.

 

Regards,

Silambarasan I



CY Chong Yee Mei November 18, 2014 03:41 AM UTC

Hi,

thanks for the prompt reply, the regex used in the Match filter doesnt quite meet our requirement, is there anyway to hide the "Match" option in the custom filter box?

Thanks and best regards,
Chong


SI Silambarasan I Syncfusion Team November 20, 2014 05:20 PM UTC

Hi Chong,

 

Thanks for your update.

 

We would like to let you know that we have created a workaround for your requirement (“To hide the "Match" option in the custom filter box”) can be achieved by using ClientSideOnLoadComplete client-side event.  Please refer the below code snippets.

 

CODE SNIPPET:

 

[ASPX]

 

<Syncfusion:GridGroupingControl ID="GridGroupingControl1" runat="server" Width="500"

DataSourceCachingMode="ViewState" ClientSideOnLoadComplete="removeMatchCase(this)">

<TopLevelGroupOptions ShowFilterBar="true" />

<TableDescriptor AllowFilter="true" AllowNew="false" AllowEdit="false"></TableDescriptor>

</Syncfusion:GridGroupingControl>

 

[SCRIPT]

 

<script type="text/javascript">

 

var content = "$($('.WndContent').contents().find('td')[3]).bind('mouseover', function (e) { $($($('.WndContent').contents().find('td')[3]).find('select option#FDMatch')).remove(); });";

 

function removeMatchCase(grid) {

$('.WndContent').attr("onload", content);

}

 

</script>

 

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

 

Link: SampleProject.zip

 

Please let us know if you need any further assistance.

 

Regards,

Silambarasan I



CY Chong Yee Mei March 27, 2015 03:13 AM UTC

Hi,

the code doesn't work when i view the website in compatibility view as IE 7. is there any solution for this?


AM Abdul Matin M Syncfusion Team March 30, 2015 01:43 PM UTC

Hi Chong,

Thanks for your update.

We are sorry about the inconvenience caused. We have analyzed your requirement we would like to let you know that your requirement can be achieved by using the below code snippet.

[JavaScript]

$(document).ready(function () {

$(".WndContent").bind("load", function () {

setTimeout(function () {

$($($('.WndContent').contents().find('td')[3]).find('select option#FDMatch')).remove();

}, 1000);

});

});

We have also modified the sample and have attached the sample for your reference and the same can be downloaded from the link below.

Sample: SampleProject.zip

Please use the above sample and get back to us if you have any other queries.

Please let us know if you need any further assistance.

Regards,

Abdul Matin M


Loader.
Live Chat Icon For mobile
Up arrow icon