This is a migrated thread and some comments may be shown as answers.

filter is not working properly?

1 Answer 37 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ajmal
Top achievements
Rank 1
ajmal asked on 25 Nov 2010, 11:46 AM
Hello All,

I am using telerik in buit filter functionality with only below code in HTML, but filter is not working when apply new search.
Kindly check attached grid for question explanation.

to limit filter creteria, below the JS,

var

 

column = null;

 

 

function MenuShowing(sender, args) {

 

 

if (column == null)

 

 

return;

 

 

var menu = sender;

 

 

var items = menu.get_items();

 

 

if (column.get_dataType() == "System.String") {

 

 

var i = 0;

 

 

while (i < items.get_count()) {

 

 

if (!(items.getItem(i).get_value() in { 'NoFilter': '', 'Contains': '', 'DoesNotContain': '', 'StartsWith': '', 'EndsWith': '', 'NotEqualTo': '', 'EqualTo': '' })) {

 

 

var item = items.getItem(i);

 

 

if (item != null)

 

item.set_visible(

false);

 

}

 

else {

 

 

var item = items.getItem(i);

 

 

if (item != null)

 

item.set_visible(

true);

 

}

i++;

}

}

 

if (column.get_dataType() == "System.Int64") {

 

 

var j = 0;

 

 

while (j < items.get_count()) {

 

 

if (!(items.getItem(j).get_value() in { 'NoFilter': '', 'GreaterThan': '', 'LessThan': '', 'NotEqualTo': '', 'EqualTo': '', 'Contains': '', 'DoesNotContain': '', 'StartsWith': '', 'EndsWith': '' })) {

 

 

var item = items.getItem(j);

 

 

if (item != null)

 

item.set_visible(

false);

 

}

 

else {

 

 

var item = items.getItem(j);

 

 

if (item != null)

 

item.set_visible(

true);

 

}

j++;

}

}

 

if (column.get_dataType() == "System.Boolean") {

 

 

var j = 0;

 

 

while (j < items.get_count()) {

 

 

if (!(items.getItem(j).get_value() in { 'NoFilter': '', 'EqualTo': '' })) {

 

 

var item = items.getItem(j);

 

 

if (item != null)

 

item.set_visible(

false);

 

}

 

else {

 

 

var item = items.getItem(j);

 

 

if (item != null)

 

item.set_visible(

true);

 

}

j++;

}

}

column =

null;

 

}

 

function filterMenuShowing(sender, eventArgs) {

 

column = eventArgs.get_column();

}



And the Grid is below,


 

<telerik:RadGrid runat="server" Width="580px" Height="350px" Style="margin: 7px 0px 0px 7px;"

 

 

ID="grdDelegation" AutoGenerateColumns="False" AllowPaging="True" GridLines="None"

 

 

PageSize="5" AllowFilteringByColumn="true"

 



<

 

ClientSettings EnablePostBackOnRowClick="true" AllowColumnsReorder="True" ReorderColumnsOnClient="True">

 

 

<Selecting AllowRowSelect="True" />

 

 

<ClientEvents OnFilterMenuShowing="filterMenuShowing" />

 

 

</ClientSettings>

 

 

<GroupingSettings CaseSensitive="false" />

 

 

<FilterMenu OnClientShown="MenuShowing" />

 

 

<HeaderStyle Font-Bold="true" HorizontalAlign="Center" />

 



1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 29 Nov 2010, 12:12 PM
Hello Ajmal,

The provided code looks ok to me.
As the provided information is not enough to isolate the root cause of the issue you are facing, please prepare a simple, fully runnable reproduction demo, open a new support ticket and send it to us along with very detailed reproduction steps and explanations and we will debug it locally and we will do our best to help.



Kind regards,
Maria Ilieva
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
ajmal
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or