0

I am using kendo autocomplete and datasource is hardcoded.i have to show the items in the autocomplete which are not selected.So i have to hide the values which are already selected.For that i am using the following code

        // create a datasource bound to the local data 
        var status = [
                "Accountable",
                "Collection",
                "Write Off"
            ];
        //Lookup
        $("#collection_status").kendoAutoComplete({
            dataSource  : status,
            filter          : "startswith",
            separator       : ",",
            dataBound: function(e) {
                var colDs       =   $("#collection_status").data("kendoAutoComplete").dataSource._data;
                var colStatVal  =   $("#collection_status").val();
                var colStatArr  =   colStatVal.split(",");
                colStatArr.pop();
                $.each(colStatArr, function(ind, val) {
                    if($.inArray(val, colDs) > -1){
                        colDs.splice(ind,1);
                    }
                });
            },
            animation: {
                open: {
                    effects: "fadeIn",
                    duration: 1,
                    show: true
                }
            }
        });

But sometimes this code is showing the selected ones..How to correct this.Any help is much appreciated.

웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91
  • Did you consider using multiselect? It displays _only_ those not selected. – OnaBai May 29 '13 at 14:34
  • Well yes but when i upgraded the version of kendo there are certian errors occuring in my project.So i cant upgrade the new kendo verison and in my existing verision it does not have kendoMultiSelect.So i need an alternative – 웃웃웃웃웃 May 30 '13 at 03:27

0 Answers0