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

How to register for filter button click event in client code for gri

0 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
steven
Top achievements
Rank 1
steven asked on 04 Dec 2014, 03:38 AM
I hope u can help me. 
I am coding for the grid that is used in the Telerik MVC Extensions.
I know that it is not supported any more but I thought maybe the current grid has the same style and format.
What I am needing to do is register for the click event for the filter button that is clicked on to apply the filters the user chooses. This is the button that appears in the popup where the user chooses the filters. This is the button that when clicked on causes the server's action method for the Select event to be called.The attached photo shows the filter button I am talking about.

What I am trying to do is write client side code would register one event handler for all the individual click events associated with each filter button in each column filter pop up iin a grid, and also individual event handlers for each click event.

I added code in the grid onLoad event handler to register for the click event but it does not work
I tried first registering for filter button click event the is associated with the first column
   function gud_onLoad(e) {
$('#UnAssignedDevices th:eq(1)')
.find(".t-filter-button") //find the filter button
.click(function (e) { // subscribe to its click event
alert("filter  button 1");
});

That did not work so I then tried for any filter button click event,
   function gud_onLoad(e) {
$("#UnAssignedDevices .t-filter-button").click(function (e) { // subscribe to
its click event
alert("filter button 1");
});
That did not work either

Below is the code for the grid
<%=
Html.Telerik().Grid((IEnumerable<CommandCenter.Models.DeviceViewModel>)ViewData["Devices"])
.Name("UnAssignedDevices")
.Columns(columns =>
{
columns.Bound(d => d.HostId).Visible(false);
columns.Bound(d => d.HostName)
.ClientTemplate("<input type='checkbox' name='chk_add_devices'
value='<#= HostName #>' onclick='select_grp_ua_device(this,this.checked, this.value)'
/>")
.HeaderTemplate("<input type='checkbox'
name='chk_select_grp_ua_devices_hdr' onclick='select_all_grp_ua_devices(this.checked)' />
<span class='box_sep'>Check All</span>")
.Title("Check")
.Width("10%")
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(d => d.HostName)
.Width("25%");
columns.Bound(d => d.SerialNo)
.Width("25%");
columns.Bound(d => d.TopAssembly)
.Width("25%");
columns.Bound(d => d.MacAddress).Width("25%");
columns.Bound(d => d.Installed).Width("25%");
})
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("UnAssignedDevices", "DeviceManagement", new { cid =
ViewData["sel_cid"], gid = ViewData["gid"] });
})
.ClientEvents(events => events
.OnDataBinding("gud_onDataBinding")
.OnDataBound("gud_onDataBound")
.OnRowDataBound("gud_onRowDataBound")
.OnLoad("gud_onLoad")

)
.Pageable()
.Filterable()
%>

No answers yet. Maybe you can help?

Tags
Grid
Asked by
steven
Top achievements
Rank 1
Share this question
or