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

Support for multiple select #11

Open
fast-one opened this issue Aug 12, 2013 · 6 comments
Open

Support for multiple select #11

fast-one opened this issue Aug 12, 2013 · 6 comments
Assignees

Comments

@fast-one
Copy link

Hi,

The current plugin works great, do you have any plans to support multi-select (multiple attribute in select)?

Thanks,
Raghu

@fast-one
Copy link
Author

Here is the code snippet that I had in place:

Line 41:
var selected = [];
$(parent_selector).each(function() {
$(":selected", this).each(function() {
selected.push($(this).val());
});
});

Line 56:
var hasSelectedClass = false;
var classList = ($(this).attr('class') == undefined || "" ) ? [] : $(this).attr('class').split(/\s+/);
$.each( classList, function(index, item){
if (jQuery.inArray(item, selected) >= 0) {
hasSelectedClass = true;
return;
}
});
if (!hasSelectedClass &&
!$(this).hasClass(selected_first) && $(this).val() !== "") {
$(this).remove();
}

benwbrum added a commit to benwbrum/jquery_chained that referenced this issue Nov 12, 2013
Coverted variables describing what's currently selected into an array.
This breaks the tests, as it appears not to be compatible with the
support for multiple parents to a selector.
@tuupola tuupola added the 2.0 label Sep 27, 2014
@tuupola tuupola self-assigned this Sep 27, 2014
@tuupola tuupola added the feature label Mar 2, 2015
@prabinkarma
Copy link

trying to implement multiple select option but just one option value selected. please help

@prabinkarma
Copy link

$response[""] = "--";
$response["a1"] = "A1";
$response["a3"] = "A3";
$response["s3"] = "S3";
$response["a4"] = "A4";
$response["s4"] = "S4";
$response["a5"] = "A5";
$response["s5"] = "S5";
$response["a6"] = "A6";
$response["s6"] = "S6";
$response["rs6"] = "RS6";
$response["a8"] = "A8";
$response["selected"] = "s6";
$response["selected"] = "s5";
$response["selected"] = "s4";
print json_encode($response);

is this the correct way to define multiple select

@tuupola
Copy link
Owner

tuupola commented Apr 2, 2015

Multiple selects are not supported at the moment.

@fast-one
Copy link
Author

fast-one commented Apr 2, 2015

Hi Prabinkarma,

Did you try the code I posted? Multi-select works for me with that code. My code is based on Version: 0.9.4.

Regards,
Raghu

@monsurhoq
Copy link

Hi @prabinkarma ,
I also used @fast-one solution with 1.0.0 version today.
It's working fine.

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

No branches or pull requests

4 participants