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

[Solved] Ajax binding - do not auto load

1 Answer 39 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.
Eduardo
Top achievements
Rank 1
Eduardo asked on 12 Apr 2012, 08:42 PM
In my app, I have a panel in a panel bar with a series of filters. On the "OnExpand" event of this panel, I have to populate a grid inside the next panel based in the chosen filters. I'm doing this via this functions:

function onExpand(e) {
        var item = $(e.item);
        var element = (item.find('> .t-link').text());
        if (element == 'ConcessionĂ¡rias') {
            var grid = $("#Grid").data("tGrid");
            grid.rebind()
        }
    }

function gridConcessionariaDataBiding(e) {
        e.data = {
            param: parameters()
        };
    }


This works (not sure if is the best way, but works anyway). Howevar, my grid (below) is calling the server when the page is first loaded, when there's no filters selected, thus, making a worthless request. What I need is that this grid only make the databind by client request - do not load values on pageload. Can I have some help?

@(Html.Telerik().Grid<SicofgII.EntityDataModel.Concessionaria>()
                                .Name("Grid")
                                .ClientEvents(events => events.OnDataBinding("gridConcessionariaDataBiding"))
                                .Columns(columns =>
                                    {
                                        columns.Bound(o => o.idConcessionaria)
                                               .ClientTemplate("<input type='checkbox' name='checkedConcessionaria' value='<#= idConcessionaria #>' />")
                                               .Title("")
                                               .Width(36)
                                               .HtmlAttributes(new { style = "text-align:center" });
                                        columns.Bound(o => o.Sigla).Width(120);
                                        columns.Bound(o => o.NomeFantasia);
                                    })
                                    
                                .DataBinding(dataBinding => dataBinding.Ajax()
                                    .Select("loadConcessionarias", "Calculo")
                                    .OperationMode(GridOperationMode.Client))
                                .Sortable()
                                .Footer(false)
                                .Scrollable())

1 Answer, 1 is accepted

Sort by
0
Shreyans
Top achievements
Rank 1
answered on 13 Apr 2012, 01:56 AM
Try this

   .DataBinding(dataBinding => dataBinding.Ajax().OperationMode(GridOperationMode.Client)
                                                       .Enabled(false)

for me it screws up the sorting, if that not important to you.
Tags
Grid
Asked by
Eduardo
Top achievements
Rank 1
Answers by
Shreyans
Top achievements
Rank 1
Share this question
or