mtoledo87 / dropdown-check-list

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

Request: option to change when underlying list is updated #152

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
** What steps will reproduce the problem?

Bind a change event on the select list somehow, then apply dropdownchecklist. 
I'm using a dotnet list control with autopostback. The change event is fired 
when the user checks a box, since the underlying select receives a change right 
away. E.g.

var foo="";
$(document).ready(function() {
    $("#mylist").change(function () {
        foo += "<br />Change event happened";
        $("#debug").html(foo);
    }).dropdownchecklist();
});

I would like a config option so that the underlying select box isn't updated 
until the onComplete event is fired; that is, the underlying lists change event 
is not fired until you CLOSE the checklist, because its values wouldn't 
changing "live".

The second effect of this [I hope] would be that you could open the list, tick 
an option, change your mind and untick it and close the list again, leaving it 
in its original state. The list would not be "dirty" since the selected state 
wouldn't be changed, therefore the change event also wouldn't fire.

** What is your environment?
-- DropDownCheckList version: latest
-- jQuery version: 1.4.2
-- jQuery UI version: 1.8.5
-- Browser and version: chrome 9

Original issue reported on code.google.com by tim.stcl...@gmail.com on 9 Feb 2011 at 11:14

GoogleCodeExporter commented 8 years ago
Just noting that the code that might need to be looked at for this request 
seems to be centered around lines 280 & 281 (v1.1); if you could add a config 
param such as "autoChange" (boolean) so that it excluded these lines from the 
checkBox.click function

280 - self._syncSelected(aCheckBox);
281 - self.sourceSelect.trigger("change", 'ddcl_internal');

then later in the onComplete routine set up the ability to apply the change 
list (if any) to the select and THEN trigger change on it, this would be ideal. 

Cheers :)

Original comment by tim.stcl...@gmail.com on 9 Feb 2011 at 11:25

GoogleCodeExporter commented 8 years ago
Had I not been lying in bed trying to solve this problem I would have come up 
with these changes. I've made changes to dropdownchecklist.js to support the 
functionality the way I'd like.

I've added a dirty flag which is set if you make a change (it doesn't 
self-undo, so change still triggers if you set then unset an item). I've added 
an option called triggerOnChange (boolean; true) which then prevents the change 
trigger from firing until you close the list.

Sorry, don't have access to a diff/patch tool on me so I've attached the 
changed file

(also pasted on http://codepad.org/wS112rn6)

Would be great to see this kind of option included in a future supported 
release.

Original comment by tim.stcl...@gmail.com on 9 Feb 2011 at 10:14

Attachments:

GoogleCodeExporter commented 8 years ago
I will add this feature to the wish-list for a future release.

Original comment by womohun...@ittrium.com on 18 Feb 2011 at 2:37