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

[Solved] Grid doesn't filter or group

2 Answers 12 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jan
Top achievements
Rank 1
Jan asked on 29 Aug 2011, 05:21 PM
Hi,

My grid doesn't filter or group anymore. It correctly rebinds to the data with the comboboxes.
Any ideas? Thanks!

<%= Html.Telerik().DropDownList()
                .Name("comboTarificationOffice")
                .BindTo((IEnumerable<SelectListItem>)ViewData["tarificationoffices"]).SelectedIndex(0)
                .HtmlAttributes(new { style = "width: 200px;" })
                .ClientEvents(events => events.OnChange("Combo_onChange"))
%>
 
<%= Html.Telerik().DropDownList()
                .Name("comboMonths")
                .BindTo((IEnumerable<SelectListItem>)ViewData["months"]).SelectedIndex(0)
                .HtmlAttributes(new { style = "width: 200px;" })
                .ClientEvents(events => events.OnChange("Combo_onChange"))
%>
 
<%= Html.Telerik().DropDownList()
                .Name("comboYears")
                .BindTo((IEnumerable<SelectListItem>)ViewData["years"]).SelectedIndex(0)
                .HtmlAttributes(new { style = "width: 200px;" })
                .ClientEvents(events => events.OnChange("Combo_onChange"))
%>
 
 
<%= Html.Telerik().Grid<VerifyStagingItem>()
        .Name("Grid")
        .DataBinding(dataBinding => dataBinding.Ajax().Select("_DataStaging", "Staging"))
        .Pageable(pager => pager.PageSize(100))
        .Sortable()
        .Scrollable(g => g.Height("800px"))
        .Groupable()
        .Filterable()
%>
 
    <script type="text/javascript">
 
        function Combo_onChange() {
            var cboTarificationOffice = $('#comboTarificationOffice').data('tDropDownList');
            var cboMonths = $('#comboMonths').data('tDropDownList');
            var cboYears = $('#comboYears').data('tDropDownList');
 
            var valTarificationOffice = cboTarificationOffice.value();
            var valMonths = cboMonths.value();
            var valYears = cboYears.value();
             
            var grid = $("#Grid").data("tGrid");
            grid.rebind({ idTarificationOffice: valTarificationOffice, year: valYears, month: valMonths });
            grid.ajaxRequest();
        }
 
    </script>
 
 
<% Html.EndForm(); %>
</asp:Content>

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 30 Aug 2011, 07:13 AM
Hello Jan,

 This is probably caused by a known breaking change. Parameters set through the rebind method are no longer persisted on subsequent request. You need to pass those parameter via the OnDataBinding event:

function onDataBinding(e) {
     var cboTarificationOffice = $('#comboTarificationOffice').data('tDropDownList');
     var cboMonths = $('#comboMonths').data('tDropDownList');
     var cboYears = $('#comboYears').data('tDropDownList');
  
     var valTarificationOffice = cboTarificationOffice.value();
     var valMonths = cboMonths.value();
     var valYears = cboYears.value();
              
     e.data = { idTarificationOffice: valTarificationOffice, year: valYears, month: valMonths };
}
function Combo_onChange() {
   var grid = $("#Grid").data("tGrid");
   grid.rebind()
}

Kind regards,
Atanas Korchev
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Jan
Top achievements
Rank 1
answered on 30 Aug 2011, 09:31 AM
This solved my problem.
Thanks a lot!
Jan
Tags
Grid
Asked by
Jan
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Jan
Top achievements
Rank 1
Share this question
or