RajeshChaudhary345 / dropdown-check-list

Automatically exported from code.google.com/p/dropdown-check-list
0 stars 0 forks source link

extended functions #134

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Not sure if this helps anyone, but my requirement has me needing to register a 
click event on each checked item, this was too allow for a dialog to open to 
add a free text option.. 

This was created with version 1.0 as 1.1 has issues inside of the 
accordian\\tab controls.. I cant drop in the full source as I am working on 
some open events etc.

:: added to _createDropItem handler

label.css({ cursor: "default" });
            label.text(text);
            checkBox.click(function(e) { self._handleClick(checkBox,label);} );  <-- this line added to handle a click event
            if (indent) {
                item.addClass("ui-dropdownchecklist-indent");
            }

::new handler created 
_handleClick: function(checkBox,label)
        {
            if ( $.isFunction(this.options.selected) ) {
                try {
                    this.options.selected(checkBox,label);
                } catch(ex) {
                    alert( 'selected failed: ' + ex.Description );
                }
            }
        },

:: sample call script
$('#s1').dropdownchecklist({ width: 250,        
        selected: function (checkBox, label) {
//returns both the checkBox input control and the associated label control
            if (checkBox.is(':checked')) {
                var text = $(label).text();
                ..........
            }
        }
    });

only tested in 1.0 and not fully QA'd

Original issue reported on code.google.com by bigvang...@gmail.com on 12 Oct 2010 at 4:52

GoogleCodeExporter commented 8 years ago
I will add this type of functionality to the 'wish' list

Original comment by womohun...@ittrium.com on 14 Dec 2010 at 9:27

GoogleCodeExporter commented 8 years ago
Fixed in 1.3 (see onItemClick option)

Original comment by womohun...@ittrium.com on 13 Apr 2011 at 5:07