erhanfirat / combo-tree

ComboTree is a jQuery Plugin which is a combobox item with tree structured data list and multi/single selection options and more.
MIT License
79 stars 67 forks source link

comboTree1.destroy is not a function #26

Closed mrhieuit closed 4 years ago

mrhieuit commented 4 years ago

Hello Erhanfirat,

Your plugin is great! However I has a problem when call Destroy method, How to call the destroy function properly? I use your demo code but it did not perform successfully:

var SampleJSONData = [
    {
        id: 0,
        title: 'Horse'
    }, {
        id: 1,
        title: 'Birds',
        subs: [
            {
                id: 10,
                title: 'Piegon'
            }, {
                id: 11,
                title: 'Parrot'
            }, {
                id: 12,
                title: 'Owl'
            }, {
                id: 13,
                title: 'Falcon'
            }
        ]
    }, {
        id: 2,
        title: 'Rabbit'
    }, {
        id: 3,
        title: 'Fox'
    }, {
        id: 5,
        title: 'Cats',
        subs: [
            {
                id: 50,
                title: 'Kitty'
            }, {
                id: 51,
                title: 'Bigs',
                subs: [
                    {
                        id: 510,
                        title: 'Cheetah'
                    }, {
                        id: 511,
                        title: 'Jaguar'
                    }, {
                        id: 512,
                        title: 'Leopard'
                    }
                ]
            }
        ]
    }, {
        id: 6,
        title: 'Fish'
    }
];

comboTree1 = $('.size').comboTree({
    source : SampleJSONData,
    isMultiple: true,
    cascadeSelect: true,
    selected: ['0']
});

// To remove plugin comboTree1.destroy(); ===> comboTree1.destroy is not a function

  1. How to call the destroy function properly?
  2. Can I destroy all comboTree at one, For example: $('.size').comboTree('destroy'); Note: I have multi elems with class is "size" on page.
mrhieuit commented 4 years ago

In version 1.2.1, i can call destroy() successfully. I will close this issue now.