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

[Solved] Filter from clientside issues?

4 Answers 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jang-Soo Lee
Top achievements
Rank 1
Jang-Soo Lee asked on 16 Sep 2009, 08:15 PM
I'm using an evaluation version of 2009.2.701.35, and seem to be running into issues filtering from the clientside. Whenever I try to call the filter function on the mastertableview, it gives me an error within the MicrosoftAjax.js served by TelerikWeb.UI.WebResource.axd, specifically that the trim() function is not available on a variable i. This error is within the Sys$Enum$parse function of that file.

The way that I'm calling the function that I'm calling is as thus (from a RadComboBox):
        function filterCounty(sender, args){
            $find(<%=RadGrid1.ClientID%>).get_masterTableView().filter("CountyCode", sender.get_value(), Telerik.Web.UI.GridFilterFunction.EqualTo);
//            alert(sender.get_value());
        }

Based on what I'm seeing, the enum gets evaluated to the numeric value 5, and then is sent to the Sys$Enum$parse function. For whatever reason, the javascript engine seems to choke at this point.

Is this a problem that has been run into before? 

4 Answers, 1 is accepted

Sort by
0
Jang-Soo Lee
Top achievements
Rank 1
answered on 17 Sep 2009, 03:09 PM
Just as added information, the call seems to originate from toDynamicLinq:function(b). This is what is given to my browser:
toDynamicLinq:function(b){var h="";
if(typeof(b)!="undefined"){h=b
}var i="";
if(this._filterFunction!=null){var g=Telerik.Web.UI.GridFilterFunctionsDynamicLinqFormat();
var f=g[Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction)];
if(f!=null){var a=Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction);
var e="";
var d="";
if(a==Telerik.Web.UI.GridFilterFunction.IsNull||a==Telerik.Web.UI.GridFilterFunction.NotIsNull){e=""
}else{if(a==Telerik.Web.UI.GridFilterFunction.Between||a==Telerik.Web.UI.GridFilterFunction.NotBetween){d=this.getDynamicLinqValue(this._fieldValue.split("")[1]);
e=this.getDynamicLinqValue(this._fieldValue.split(" ")[0])
}else{e=this.getDynamicLinqValue(this._fieldValue)
}}var c=this._fieldName;
if(h!=""){c=String.format("{0}.{1}",h,c)
}i=String.format(f,c,e,d)
}}return i
}

The line that calls the Sys$Enum$parse function is the below line. _filterFunction corresponds to 5: 
var f=g[Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction)]; 

When I try with a string filtertype, instead of Linq, it also errors at the parse function, but from a different source:
toString:function(b){var h="";
if(typeof(b)!="undefined"){h=b
}var d=this._fieldName;
if(h!=""){d=String.format("{0}.{1}",h,d)
}var i="";
if(this._filterFunction!=null){var g=Telerik.Web.UI.GridFilterFunctionsSqlFormat();
var f=g[Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction)];
if(f!=null){var a=Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction);
if(a!=Telerik.Web.UI.GridFilterFunction.Between&&a!=Telerik.Web.UI.GridFilterFunction.NotBetween){if((this.get_dataTypeName()=="System.String"||this.get_dataTypeName()=="System.Char")&&a==Telerik.Web.UI.GridFilterFunction.Contains||a==Telerik.Web.UI.GridFilterFunction.DoesNotContain||a==Telerik.Web.UI.GridFilterFunction.StartsWith||a==Telerik.Web.UI.GridFilterFunction.EndsWith){i=String.format(f,d,this._fieldValue)
}else{i=String.format(f,d,this.getQuotedValue(this._fieldValue))
}}else{var e=this._fieldValue.split(" ")[0];
var c=(this._fieldValue.split(" ").length>0)?this._fieldValue.split(" ")[1]:"";
i=String.format(f,d,this.getQuotedValue(e),this.getQuotedValue(c))
}}}return i
}

It happens at the below line:
var f=g[Telerik.Web.UI.GridFilterFunction.parse(this._filterFunction)];

0
Jang-Soo Lee
Top achievements
Rank 1
answered on 18 Sep 2009, 01:49 PM
Just as a note: The documentation for the filter function found here: http://www.telerik.com/help/aspnet-ajax/grid_filter.html seems to be wrong. This is what caused the error.

Currently, the documentation says to use the enum (e.g. Telerik.Web.UI.GridFilterFunction.EqualTo), whereas the actual client-side filter function being used by the default RADGrid behavior uses a string ("EqualTo")

Thus, changing from:
$find(<%=RadGrid1.ClientID%>).get_masterTableView().filter("CountyCode", sender.get_value(), Telerik.Web.UI.GridFilterFunction.EqualTo);

to:
$find(<%=RadGrid1.ClientID%>).get_masterTableView().filter("CountyCode", sender.get_value(), "EqualTo");

made the script behave properly.

Please confirm and correct the documentation.

Thanks,
-Jang-Soo Lee
0
Pavel
Telerik team
answered on 22 Sep 2009, 02:22 PM
Hello Jang-Soo Lee,

I cannot reproduce the problem you described as both ways seem to work on my end. Find attached a simple example which behaves as expected with the latest version of the controls. Try it out and let us know what is different in your scenario.

Best wishes,
Pavel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ali Khamis
Top achievements
Rank 1
answered on 16 Feb 2010, 12:17 PM
I faced the same problem above, and the string filter type "Contains" instead of 1 solved the problem !!! thanks Jang-Soo Lee
Tags
Grid
Asked by
Jang-Soo Lee
Top achievements
Rank 1
Answers by
Jang-Soo Lee
Top achievements
Rank 1
Pavel
Telerik team
Ali Khamis
Top achievements
Rank 1
Share this question
or