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

setting Grid Row items to DropdownList

3 Answers 146 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 28 Jan 2015, 08:35 PM
Hello There,

I have two lists: 1) Grid  2) DropdownList.  I can add new row to the grid from the dropdownlist selection.  What I like to accomplish is to edit the dropdownlist, when the row is selected in the Grid.  I can see my selection but my code failed to update the dropdownlist.  Your help is greatly appreciated   

Here are the codes

  
onSelect : function(e) {
                e.preventDefault();
                var self = this;          
                window.console && console.log("MVN what is self here:  "+self);
                var kendoGrid = $("#facultySupportGrid").data("kendoGrid");
 
                var selectedRow = kendoGrid.select();
                var selected = kendoGrid.dataItem(selectedRow);
                
                if (selected !== null) {
                    self.set("addFacultySupportSectionVisible", true);              
                    self.set("selectedId", selected.id);
 
                    alert(selected.facultyFullName)
                    self.set("selectedFullName", selected.facultyFullName);       
                    // Hide button when fields are expanded
                    self.set("hideAddFacultyButton", false);
                }
            },

<h2>Add Faculty Information</h2>
            <label class="control-label">Name*:</label>
            <input id="newFacultyDropDown" name="newFacultyDropDown" data-role="dropdownlist"
                   data-option-label="- select faculty -"
                   data-auto-bind="true"
                   data-text-field="value"
                   data-value-field="key"
                   data-bind="value: selectedFullName,source: fundingFacultiesList" required validatemessage="Name is required" />
            <span class="k-invalid-msg" data-for="newFacultyDropDown"></span>
        </div>
        

3 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 29 Jan 2015, 11:41 AM
Sorry I forgot to include the grid 
<div id="facultySupportGrid" data-role="grid"
         data-editable="false"
         data-selectable="true"
         data-scrollable="true"
         data-sortable="true"
         data-pageable="false"
         data-columns="[
                { 'field': 'id'},
                {title:'Name','field': 'facultyFullName','width': '250px'},
                {title:'Role', 'field':'facultyRole'},
                {title:'Action', 'width': '120px', template:kendo.template($('#facultySupport-deleteLink').html() ) }
 
         ]"
         data-bind="source: fdingParticipatingGridView,
                    events:{
                         change:onSelect,
                         dataBound: dataBoundFtySupport
                    }">
 
    </div>
0
Alexander Valchev
Telerik team
answered on 30 Jan 2015, 10:07 AM
Hi Michael,

Your configuration looks correct. I am not sure where exactly the problem comes from.
Could you please confirm that the value of the selectedFullName field matches one of the "key" values from fundingFacultiesList?

Regards,
Alexander Valchev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Michael
Top achievements
Rank 1
answered on 02 Dec 2015, 07:23 PM

Hi sorry this has been resolved 

Thanks

Tags
DropDownList
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Alexander Valchev
Telerik team
Share this question
or