Can't select item in list created by ui-select2

孤者浪人 提交于 2019-12-03 12:16:16
biesczadka

the problem was that Priv class/table didn't have id property, and its Primary Key was field code. I had to add function :

id : function(priv) {
        return priv.code;
     },

in $scope.privNameSelect2options

Sean

Please refer to Select2 Ajax Method Not Selecting,

and take the correct value:

id: function(data){return {id: data.id};},

or

id: function(data){return data.id}

Although this isn't really specified in the select2 documentation, you'll need to pass an id key with a function value to select2.

$scope.privsSelect2options = {
    id: function(element) { return element.name; }
    ...
}; 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!