简体   繁体   中英

Inside jquery datatable binding multi select dropdown in each row

One of my jquery Datatable Column.(Using Chosen.Jquery.js) Line No: 3 I have mentioned multiple class = "Chosen-Select" but it is not working.

           { "data": "Tagss",
           "render": function (d, t, r) {
            var $select = $('<select multiple class="chosen-select</select>', 
                               {
                                    "id": r[0] + "start",
                                    "value": d
                                });

                                var items = "";
                             $.each(d, function (i, item) {
                                    var $option = $("<option></option>", {
                                        "text": item.PageName,
                                        "value": item.pageTagId
                                    });
                                    if (d == item) {
                                        $option.attr("selected", "selected")
                                    }
                                    $select.append($option);
                                });
                                return $select.prop("outerHTML");

                                //return $select.prop('selected', true).trigger('change');


                            }

                        },

Firstly , you have missing double quote in you class while applying.

secondly apply css after html is rendered. Because your control is not getting css and not properly applying.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM