Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deselect not possible for single selection #37

Open
MarcDD opened this issue Aug 10, 2012 · 6 comments
Open

Deselect not possible for single selection #37

MarcDD opened this issue Aug 10, 2012 · 6 comments

Comments

@MarcDD
Copy link

MarcDD commented Aug 10, 2012

Choosen nicely supports deselection in single select mode. You only have to ensure that the first option tag is empty. Unfortunately, this no longer works with ajax-choosen.

It would be great if that was included.

@joshuaballoch
Copy link

@MarcDD I found this issue that is related to your question: #31

However, I have tested this myself and have yet to make this work. Will update you otherwise.

@joshuaballoch
Copy link

@MarcDD I have verified that this works, check the link in the previous comment.

@dsingh948
Copy link

jQuery(function($){

$(document).ready(function() {

    $("#suburbsfilter").ajaxChosen({

minTermLength:1,
type: 'GET',
url: '<?php echo base_url(); ?>frieght-admin/addseo_other/getsuburb',
dataType: 'json'

}, function (data) {
var results = [];

$.each(data, function (i, val) {
    results.push({ value: val.value, text: val.text });
});

return results;

},{"allow_single_deselect": true ,no_results_text: "Oops, nothing found!"}

);

});});

this is not working....

"allow_single_deselect": true ,no_results_text: "Oops, nothing found!"
still showing same looking message ...and dropdwon is still not de selectable ...
using all latest files for jquery....

@wejrowski
Copy link

I can't get this to work either!.. with same field I try just using .chosen({ allow_single_deselect:true }) and that works, but not with ajaxChosen

@wejrowski
Copy link

Oops it DOES work. I had to put the extra chosen JSON as an additional field. I was appending it to the ajaxChosen options in first argument which wasn't working.

@jahrralf
Copy link

jahrralf commented Oct 13, 2016

@wejrowski Could you please post a full example? I also have problems, this problem is driving me nuts...

What I have now is this:

        $("#account_id").ajaxChosen({
            type: 'GET',
            url: '<?= url_for("my_talk/autocomplete_account_json") ?>',
            dataType: 'json'
        }, function (data) {
            var results = [];

            $.each(data, function (i, val) {
                results.push({value: val.value, text: val.text});
            });

            return results;
        }, {
            allow_single_deselect: true
        }, {
            allow_single_deselect: true
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants