Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

473
Visualizações
Set kendo DataSource without calling read()

Is it possible to set the DataSource of a Kendo ListView without having the DataSource then call the read() method?

I have a main DataSource that I am using on a ListView and all of the child ListViews but am just filtering it for each ListView depending on a few conditions. The way that I'm doing this is once all of the data has been bound to the main ListView then I create all of the child ListViews and assign the same datasource with filtering.

The issue I'm having here is once I assign the filtered DataSource to the new ListView it seems to be calling the read method again.

baSurveyGroupTemplateDataSource: new kendo.data.DataSource({
    transport: {
        read: {
            async: false,
            url: "/Url/to/data"
            dataType: "json",
            type: "GET",
            data: {
                id: $("#TemplateId").val()
            },
        }
    }
}),             
groupDataBound: function (e) {
    $(".childBaSuveyGroupTemplate").each(function () {
        viewModel.seedGroup(this);
    });
},
seedGroup: function (parentGroup) {
    var childrenGroupList = $(parentGroup);
    var parentGroupId = childrenGroupList.data("id");
    var childrenGroupDataSource = new kendo.data.DataSource(viewModel.baSurveyGroupTemplateDataSource);
    childrenGroupDataSource.query({
        filter: ({ field: "BaSurveyGroupTemplateParentId", operator: "eq", value: parentGroupId })
    });
    childrenGroupList.kendoListView({
        template: kendo.template($("#baSurveyGroupTemplateDisplayTemplate").html()),
        dataSource: childrenGroupDataSource
    });
}

Let me know if I need to clarify anything. It's hard to try and put what I'm doing and the problem I'm having into words.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Try adding this to your ListView configuration:

autoBind: false

From the kendo documentation at http://docs.telerik.com/kendo-ui/api/javascript/ui/listview#configuration-autoBind

If set to false the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the data source is fired. By default the widget will bind to the data source specified in the configuration.

Setting autoBind to false is useful when multiple widgets are bound to the same data source. Disabling automatic binding ensures that the shared data source does not make more than one request to the remote service.

Then manually trigger the datasource read once you have everything set:

childrenGroupDataSource.read();  // "read()" will fire the "change" event of the dataSource and the widget will be bound
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda