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

Get checked items upon form submission

1 Answer 135 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 10 Jul 2018, 04:39 PM

Hello,

How do we go about getting the checked items when we submit a form containing the DropDownTree?  Specifically, I'd like to get a list of checked Id values from the TreeViewItemModel.

Thanks

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 12 Jul 2018, 11:32 AM
Hi,

The HTML <form> element would submit to the server the values of the <input> elements it contains. In the scenario when we have multiple checked items passing getting them from a value of an input in not quite flexible so in such case we would rather recommend use and ajax post request and pass the desired information in the data. Here is sample code that worked at my side:
<script>
    $("#btnSave").on("click", function (e) {
        var dropdowntree= $('#dropdowntree').data('kendoDropDownTree');
        var dDTreeItems = JSON.parse(JSON.stringify(dropdowntree.value()));
        debugger
        var data = {
            DDTreeItems: dDTreeItems
        };
 
        $.ajax('/Home/Save', {
            type: 'POST',
            data: data,
            dataType: "json"
        }).done(function () {
            alert('done');
        });
    });
 
</script>


If you have further questions please let me know.

Regards,
Plamen
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
DropDownTree
Asked by
Ryan
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or