Multiple Datasources depending on each other

2 posts, 0 answers
  1. Christopher
    Christopher avatar
    16 posts
    Member since:
    Apr 2013

    Posted 28 Aug 2015 Link to this post

    Hey guys, 

    i have a dropdown and after select i can edit the selected entry in a form (like In the form is another dropdown that depends on another datasource, but the selected value is based on the first on. But if i send a save, then the whole Objekt from the second dropdown is send (something like {ID:"1",text:"abc",check:"true"}) and not the ID only. How can i achieve, that only the ID would be send? 


    The code vor the observable for the first dropdown which delivers informations for the form:

    $(document).ready(function() {
        var objectViewModel = kendo.observable({
            objectSource: new{
                transport: {
                    read: {
                        url: '" . $config['odata_url'] . "Objects?\$filter=ID eq \'" . $_GET["id"] . "\'',
                        dataType: 'json',
                        type: 'GET',
                        contentType: 'application/json',
                        complete: function (jqXhr, textStatus) {
                            if (textStatus == 'success') {
                                $('#windowPopupNotification').data('kendoNotification').show('Data loaded successfully (Object)', 'success');
                            } else {
                                $('#windowPopupNotification').data('kendoNotification').show('Error while loading data (Object)', 'error');
                    update: {
                        url: '" . $config['odata_url'] . "Objects(\'" . $_GET["id"] . "\')?lang=de',
                        dataType: 'json',
                        type: 'MERGE',
                        contentType: 'application/json',
                        complete: function (jqXhr, textStatus) {
                            if (textStatus == 'nocontent') {
                                $('#windowPopupNotification').data('kendoNotification').show('Data saved successfully (Object)', 'success');
                            } else {
                                $('#windowPopupNotification').data('kendoNotification').show('Error while saving data (Object)', 'error');
                    parameterMap: function(options, operation) {
                        if (operation !== 'read' && options) {
                            return kendo.stringify(options);
                batch: false,
                schema: {
                    data: 'd.results',
                    model: {
                        id: 'ID'
            selectedObject: null,
            save: function() {
            reset: function() {
            close: function() {
            showForm: function() {
                return this.get('selectedObject') !== null;
        kendo.bind($('#objectForm'), objectViewModel);

     The PHP code for the dropdown in the form.

    $DropDown = new \Kendo\UI\DropDownList('DropDownID');
                        ->attr('data-bind', 'value: selectedObject.ID')
                        ->attr('data-value-field', 'ID')
                        ->attr('data-text-field', 'Name')


    Thanks a lot!





  2. Nikolay Rusev
    Nikolay Rusev avatar
    2287 posts

    Posted 02 Sep 2015 Link to this post

    Hello Christopher,


    Indeed the DataSource will submit the whole model. This is current setup in the parameterMap, more precisely:


    /the code from the online demo/

    return {
     models: kendo.stringify(options.models)



    You can change that behavior by implementing the parameterMap in a way that only sends the required fields.


    Nikolay Rusev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top