Closed GoogleCodeExporter closed 8 years ago
Is there a way to change this post after publishing it? I did not find the
options for type and priority - it obviously isn't a "defect" but a "feature
request", if this type exists.
Original comment by mail.at....@gmail.com
on 3 Jan 2012 at 10:12
I am hesitant to try to incorporate any hard limits on the number of items
selected, since everyone has a different opinion on how to determine when you
hit the limit, and what to do when the limit is hit.
I am not quite sure how your code fragment wires into DDCL. I would have
expected you to be using the onchange callback function.
Original comment by womohun...@ittrium.com
on 9 Jan 2012 at 9:10
I'm not asking for a hardcoded limit. I personally would apreciate a function
that might be called "LimitOutput" or so, since I need it for a project.
My code turned out to be rather useless since it doesn't consider the order in
which the javascript-functions are called. I'm not at all an expert for jquery
or javascript, so you're most probably right whith what you suggested in your
last sentence - anyhow, that's beyond my knowlege. The intention of posting my
rudimentary code was to open a discussion. If no one else feels like this could
be a useful feature, that's fine, too. =)
Original comment by mail.at....@gmail.com
on 10 Jan 2012 at 8:37
But I see what you mean with "everyone has a different opinion on how to
determine when you hit the limit, and what to do when the limit is hit". Maybe
I didn't think this through. But would you happen to know a more convenient way
to achieve what I was aiming for?
Original comment by mail.at....@gmail.com
on 10 Jan 2012 at 8:40
The Demo page has an example of a callback that limits the number of values
that can be checked. I personally prefer the idea of an alert when I attempt
to click on a 4th item when the limit is 3. Then the system can tell me why I
can no longer click. If the other options just went disabled after picking 3,
as a user, I would be scratching my head as to why the control changed.
From the sample:
onItemClick: function(checkbox, selector){
var justChecked = checkbox.prop("checked");
var checkCount = (justChecked) ? 1 : -1;
for( i = 0; i < selector.options.length; i++ ){
if ( selector.options[i].selected ) checkCount += 1;
}
if ( checkCount > 3 ) {
alert( "Limit is 3" );
throw "too many";
}
}
Original comment by womohun...@ittrium.com
on 10 Jan 2012 at 3:12
Erm... jap, that's pretty much what I was looking for... Now I feel stupid =)
The problem is that I have to use an earlier version of DDCL (smth. btw. 0.8
and 1.0), where this function doesn't exist. Anyhow, thanks for your help, I'll
try to update it somehow. Never mind me not reading the instructions properly =)
Original comment by mail.at....@gmail.com
on 10 Jan 2012 at 4:57
I have decided to rely on the onItemClick callback function to implement any
limits on what can be selected.
Original comment by womohun...@ittrium.com
on 23 Jan 2012 at 3:30
Original issue reported on code.google.com by
mail.at....@gmail.com
on 3 Jan 2012 at 10:05