I've got one page with four grids, wrapped in a user control. The client side filtering has been tough because the javascript methods I had were stepping on each other. The rest of it works, I just can't get the filter value typed in the textbox when they click on the filter icon. In the code below I've got the code to target the correct grid, I just need to get the filter value. tableView.get_filterExpressions(); is coming up dry.
Telerik.Web.UI.dll = 2017.3.913.45
<
telerik:GridBoundColumn
DataField
=
"COMPM_ADDRESS"
FilterControlAltText
=
"Filter Name column"
AutoPostBackOnFilter
=
"true"
HeaderText
=
"ADDRESS"
SortExpression
=
"COMPM_ADDRESS "
UniqueName
=
"COMPM_ADDRESS"
AllowFiltering
=
"true"
>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"130px"
/>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"130px"
/>
<
FilterTemplate
>
<
telerik:RadTextBox
ID
=
"txtFilterCompAddress"
runat
=
"server"
Width
=
"100px"
onkeyup
=
"CompAddressOnKeyUp(this, event)"
Text='<%# Container.OwnerTableView.GetColumn("COMPM_ADDRESS").CurrentFilterValue %>'>
<
ClientEvents
OnKeyPress
=
"CompAddressKeyPress"
/>
</
telerik:RadTextBox
>
<
asp:ImageButton
ImageUrl
=
"/images/filter2.png"
runat
=
"server"
ID
=
"ImageButton1"
Value="<%#((GridItem)Container).OwnerTableView.ClientID%>" OnClientClick="ApplyFilterIcon(this); return false;" />
<
telerik:RadScriptBlock
ID
=
"radScriptAddress"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var _columnNameAddress = "COMPM_ADDRESS";
// filter icon clicked
function ApplyFilterIcon(sender)
{
var masterTableId = $(sender).attr('Value');
var tableView = $find(masterTableId);
debugger;
var filters = tableView.get_filterExpressions(); // EMPTY
var filterValue = "553"; // <<<
I
NEED THIS VALUE, WHAT THEY TYPED IN TEXTBOX
//BELOW WORKS
tableView.filter(_columnNameAddress, filterValue, Telerik.Web.UI.GridFilterFunction.Contains, true);
}
// just checks for an empty filter textbox on backspace and return to clear the filter
function CompAddressOnKeyUp(sender, evt)
{
onKeyUpFilterGridClear(sender, evt, "<%#((GridItem)Container).OwnerTableView.ClientID%>", _columnNameAddress);
}
// on a keypress; check for return to fire the filter
function CompAddressKeyPress(sender, evt)
{
onKeyPressReturnTrigger(sender, evt, "<%#((GridItem)Container).OwnerTableView.ClientID%>", _columnNameAddress);
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>