RajeshChaudhary345 / dropdown-check-list

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

Enhancement - return checkbox and selector on onItemClick and option to update the original select #185

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I needed to auto update the <select> as onItemClick click didn't do it so after 
tinkering with the code, what I finally came up is to add another callback 
value on onItemClick

from "onItemClick (checkbox)", I changed it to "onItemClick: function(checkbox, 
selector)"

then from this, I was able to update the value of the <select>

I also tested this using the jquery 1.6.1 and jquery-ui 1.8.12

http://code.jquery.com/jquery-1.6.1.min.js
http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.js

The demo code can be seen here - 
http://leejay22.slackermommy.com/ddcl/dropdownchecklist-modified.html

I haven't tested this with the other features like firstItemChecksAll

The demo also display how the <select> wasn't updated on onItemClick.

I hope this helps in further improving the plugin.

Original issue reported on code.google.com by leeja...@gmail.com on 23 May 2011 at 9:09

GoogleCodeExporter commented 8 years ago
minor change on the code

Original comment by leeja...@gmail.com on 23 May 2011 at 9:26

Attachments:

GoogleCodeExporter commented 8 years ago
Looks like a nice enhancement to me.  I will try to roll it into the next 
version. Thanks for the input.

Original comment by womohun...@ittrium.com on 26 May 2011 at 3:37

GoogleCodeExporter commented 8 years ago
Incorporated into version 1.4 - see sample that applies a limit on the count of 
items selected.

Original comment by womohun...@ittrium.com on 14 Jun 2011 at 9:17

GoogleCodeExporter commented 8 years ago
Is there a way to update the original select box quicker? I am using ajax - 
when a user clicks on a checkbox other values are dynamically altered on the 
site. Unfortunately with DDCL the original select update happens too late for 
the updated selection to be sent as parameters in an ajax request.

It seems the onitemclick trigger happens before the original select is updated. 
How can I change this around?

Original comment by Mario.Po...@gmail.com on 12 Nov 2011 at 4:01

GoogleCodeExporter commented 8 years ago
The firing of onItemClick is purposefully done before the update of the 
underlying SELECT so that the callback function has a chance to veto the 
action.  The example code of applying a limit on the count of items selected 
works just that way. 

What you are asking for is something a bit different, more like an 
'afterItemClick' callback function.  This would have to added in as an 
enhancement.

I think the call to onItemClick is fairly isolated in the source code.  So long 
as you do not need the veto ability, you could possibly alter where onItemClick 
gets called in your copy of the DDCL source.

Sorry I can't be of more help.

Original comment by womohun...@ittrium.com on 14 Nov 2011 at 3:53