shellyBelly / dropdown-check-list

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

the ability to display the selected items count instead of the text if the selected items count exceed a certain number #290

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I do a quick work around solution for my project but it will be grate if you 
add this features

** What is your environment?
-- DropDownCheckList version: DropDownCheckList v1.4
-- jQuery version: v1.8.2
-- jQuery UI version: v1.9.2

--------------------------------------------

_updateControlText: function() {

            var self = this, sourceSelect = this.sourceSelect, options = this.options, controlWrapper = this.controlWrapper;
            var firstOption = sourceSelect.find("option:first");
            var selectOptions = sourceSelect.find("option");

            var itemCounts = sourceSelect.find(":selected").length;
            if (firstOption.attr('selected') && options.firstItemChecksAll) {
                itemCounts -= 1;
            }
            var text;
            if (itemCounts > 4) {
                {
                    text = itemCounts + " items slected";
                }
            } else {
                text = self._formatText(selectOptions, options.firstItemChecksAll, firstOption);
            }

            var controlLabel = controlWrapper.find(".ui-dropdownchecklist-text");
            controlLabel.html(text);
            // the attribute needs naked text, not html
            controlLabel.attr("title", controlLabel.text());

        }

Original issue reported on code.google.com by Wael.Mha...@gmail.com on 30 May 2013 at 7:08

GoogleCodeExporter commented 9 years ago
Sorry I didnt notice the textFormatFunction

Original comment by Wael.Mha...@gmail.com on 21 Jul 2013 at 8:54