jquery_chained icon indicating copy to clipboard operation
jquery_chained copied to clipboard

Support for multiple select

Open fast-one opened this issue 11 years ago • 6 comments

Hi,

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

Thanks, Raghu

fast-one avatar Aug 12 '13 19:08 fast-one

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(); }

fast-one avatar Aug 12 '13 19:08 fast-one

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

prabinkarma avatar Apr 02 '15 00:04 prabinkarma

$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

prabinkarma avatar Apr 02 '15 00:04 prabinkarma

Multiple selects are not supported at the moment.

tuupola avatar Apr 02 '15 05:04 tuupola

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

fast-one avatar Apr 02 '15 16:04 fast-one

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

monsurhoq avatar May 13 '15 13:05 monsurhoq