DataTable with dropdown Column

后端 未结 4 1167
不思量自难忘°
不思量自难忘° 2020-12-06 07:00

I need to make dropdown as column in DataTable jQuery it is lookinng like as below right now

And I want it like the below image

and the code which I use is

4条回答
  •  隐瞒了意图╮
    2020-12-06 07:35

    You can use this way then for the dropdown setting

     "aaData": OrganizationData.OrganizationPreference.ScheduleDaysCol,
                            "columnDefs": [{ "targets": 0,"data": "DayName" },
                                {
                                "targets": 1,
                                "data": "StartDateTime",
                               "render": function (data, type, full, meta) {
                                        var $select = $("", {
                                        });
                                        $.each(times, function (k, v) {
    
                                            var $option = $("", {
                                                "text": v,
                                                "value": v
                                            });
                                            if (data === v) {
                                                $option.attr("selected", "selected")
                                            }
                                            $select.append($option);
                                        });
                                        return $select.prop("outerHTML");
                                }
    

提交回复
热议问题