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

[Solved] Different behavior between v2011.1.414 vs v2010.3.1318

4 Answers 98 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.
Alexandre Jobin
Top achievements
Rank 1
Alexandre Jobin asked on 05 May 2011, 08:03 PM
Hi!

If you are in ajax mode and you want to rebind your grid by changing a parameter like this:
$('#grid').data('tGrid').rebind({ year: 2001 });

and then you change the page or just click the refresh button, you will not have the same behavior depending of the version that you use.

With version 2010.3.1318, each ajax request after the rebind will keep the new param value (year = 2001)
With version 2011.1.414, each ajax request after the rebind will not keep the new param. It will use the one that have been used on the initialization of the grid.

Here's the syntax of my grid:
Html.Telerik().Grid<MTO.GIPI.Web.Controllers.Besoins.ViewModels.BesoinIndexGridViewModel>()
.Name("gridBesoin")
.BindTo(Model.BesoinGridData.Data)
.DataKeys(keys => keys.Add(m => m.PublicationId))
.Columns(column =>
    {
        column.Bound(a => a.Intervenant);
        column.Bound(a => a.Publication);
        column.Bound(a => a.QuantiteBesoin);
        column.Bound(a => a.QuantitePremiereLivraison);
    })
.DataBinding(bind => bind.Ajax().Select("GetBesoinIndexGridData", "Besoins", new { searchKeyword = "", year = Model.AnneeInventaire }))
.Groupable(x =>
{
    x.Enabled(true);
    x.Groups(group => group.Add(c => c.Intervenant));
})
.Pageable(page =>
{
    page.PageSize(10);
    page.Total(Model.BesoinGridData.Total);
})
.Scrollable(scroll => scroll.Height(250))
.EnableCustomBinding(true)
.Render();

4 Answers, 1 is accepted

Sort by
0
sL342799
Top achievements
Rank 1
answered on 06 May 2011, 03:42 AM
I'm facing the same issue! Hope we get a solution soon!
0
Atanas Korchev
Telerik team
answered on 06 May 2011, 06:28 AM
Hi,

 This has been noted in the changes and backwards compatibility help topic. We have explained what has changed and how to implement a workaround.

All the best,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
sL342799
Top achievements
Rank 1
answered on 06 May 2011, 03:29 PM
Managed to solve this issue by doing the following:

1. Changed the grid ajax binding registration to not pass default parameters (so only referencing the method and controller)
.DataBinding(dataBinding => dataBinding.Ajax()
                        .Select("_AjaxBindingActivityReport","Report"))

2. Storing the filter parameters that I want persisted into a  javascript variable within the function that calls grid.rebind
 
query = qType;

3. Added the code outlined in the work around to the onDataBinding function

args.data = $.extend(args.data, { queryType: query });

Seems to be working!

Thanks
0
Alexandre Jobin
Top achievements
Rank 1
answered on 06 May 2011, 04:28 PM
it work with the workaround but not completly. Take this scenario with the workaround:

Grid
  • grouped on a column, the .rebind() with the dataBinding(args) will keep it grouped
  • sorted on a column, the .rebind() with the dataBinding(args) will not keep it sorted
  • filtered on a column, i havent tested it

alex
Tags
Grid
Asked by
Alexandre Jobin
Top achievements
Rank 1
Answers by
sL342799
Top achievements
Rank 1
Atanas Korchev
Telerik team
Alexandre Jobin
Top achievements
Rank 1
Share this question
or