0

I am using the Kendo Drop Down List with Angular. Actually i want to select current items, which means i will choose one item from partial page, it will redirect to some other page, in that page i have to select that item dynamically.

HTML Code:

   <select id="controltype" kendo-drop-down-list k-options="controlDatas">/select>

Angular Code:

 $scope.objectModification=function(objectData) {
    $scope.objectDataFields = objectData;

    var objectViewPartialElement = angular.element("objectViewPartial");
    objectViewPartialElement.html("");
    $compile(objectViewPartialElement)($scope);     
    $http({
        url : './resources/staticPages/object-modification.html',
        method : "GET"
    }).success(function(data, status) {         
            $scope.data = data;             
            jQuery("objectViewPartial").html($compile($scope.data)($scope));
        }).error(function(data, status) {
                        console.log("some error occured partial page");
    }); 


    // This code i am using for that selection
     $("#controltype").data("kendoDropDownList").select(function(dataItem) {
        return dataItem.objectId === objectDataFields.objectId;         
        $("#controltype").data("kendoDropDownList").refresh();              
    });
};
bagya
  • 51
  • 10
  • from the your code above you trying to select based on objectId, did you already set this objectId as the data-value-field or data-text-field? if yes your code should've work. – Wawan Ma-chun May 26 '15 at 14:26
  • I got solution for this some other way. i placed my code inside of kendo controls event. – bagya May 27 '15 at 10:05

1 Answers1

0

I got solution for that in some other way. i placed my code inside of kendo controls event.

$scope.controlDatas = {
  dataSource: controlDatas,
  dataTextField: "controlName",
  dataValueField: "attributeId",
  dataBound: function(e) {        
      $("#controltype").data("kendoDropDownList").select(function(dataItem) {
          return dataItem.attributeId===$scope.objectDataFields.attributeId;              
          $("#controltype").data("kendoDropDownList").refresh();    
    });
  }
 };
bagya
  • 51
  • 10