gauravkumar13337 / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Issue with bind to dblclick #590

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

Binding to flot using dblclick (jQuery mouse event), only works the first time, 
I've also attempted it on other areas, not only the legend:

    //Added functionallity for hide/show legend
    $('.legendLabel').dblclick(
        function(){
            var SelReg = $(this).html();
            alert("trying to hide "+SelReg);
            choiceContainer.find("input:checked").each(function () {
                var key = $(this).attr("for");
                if( key == SelReg) {
                    //alert("Current"+key);
                    $(this).removeAttr("checked");
                }
            });
            plotAccordingToChoices();
        }
    ); 

Original issue reported on code.google.com by raphs...@gmail.com on 15 Aug 2011 at 8:39

GoogleCodeExporter commented 8 years ago
Re-plotting destroys and re-creates the legend items, so it sounds like you're 
just not rebinding the handler as part of plotAccordingToChoices.  An even 
better solution would be to use .on (or .live, if you're using jQuery pre-1.7) 
to bind the handler universally.

Original comment by dnsch...@gmail.com on 9 May 2012 at 12:09

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 9 May 2012 at 12:49