Вопрос

Scenario : consider we have two view-models use same data source masterDataSource, and we want to add a detail entity to master entity.

Question : how would you pass masterId as query string to the create method of datasource from those view-models:

var masterDataSource = new kendo.data.DataSource({
    transport: {
        create: {
            url: function() {
                return "/api/master/addItem?masterId=" + masterId;//<-- How to pass masterId form view-models
            },
            dataType: "json",
            type: "POST"
        },
    },

    schema: {
        model: {
            id: "id"
        }
    }
}
Это было полезно?

Решение

I found this solution:

var dynamicUrl = "/api/master/addItem?masterId=" + masterId;
masterDataSource.transport.options.read.url = dynamicUrl;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top