Mobius1 / Selectable

Touch enabled selectable plugin inspired by the jQuery UI widget.
MIT License
144 stars 21 forks source link

Get selectable instance #22

Closed MR-AMDEV closed 4 years ago

MR-AMDEV commented 5 years ago

1. How can i get the Selectable instance using class/filter (whatever was added during initiation) So as we can get it even if it is defined in Function ?

2. And also if i call a function whenever i click a refresh button , the instances are getting generated constantly and cause the system to lag.There should be an option so that along with creating new instance each time the previous should be destroyed OR one instance option and it refreshes only.

function selectableInit(element,getInstance){
    const selectable = new Selectable({
        appendTo: '.fm-data',
        autoRefresh: true,
        autoScroll: {
            threshold: 0,
            increment: 20,
        }, 
        classes: {
            lasso: "ui-lasso",
            selected: "ui-selected",
            container: "ui-container",
            selecting: "ui-selecting",
            selectable: "ui-selectable",
            unselecting: "ui-unselecting"
        },      
        filter: element,
        lasso:{
            border: '1px solid inherit',
            backgroundColor: 'rgba(52, 152, 219, 0.2)',
            zIndex: '1',
        },
        tolerance: 'touch'
    });

    if(getInstance == 'get'){
        return selectable.getSelectedNodes();
    }
};

3. The plugin should work for updating(dynamic) elements It should look for the class of how many elements so we have to initiate it only one time and it looks for elements , since there is an auto refresh option this should serve the purpose of re initiating/refreshing.

Thanks for the beautiful plugin

MR-AMDEV commented 5 years ago

Any update?

Mobius1 commented 4 years ago

See Retrieving Instance.