本文介绍了绑定列表值到表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友,



我有一张如下表格

Hi Friends,

I have a table like below

<div class="datatable-tools">
            <table class="table" id="tblInfo">
                <thead style="font-size:14px;">
                    <tr>

                        <th>Name</th>
                        <th>Years</th>
                        <th>Months</th>
                        <th>Number</th>
                        <th>Number2</th>
                        <th>Number3</th>
                        <th>Gender</th>
                    </tr>

                </thead>
                <tbody></tbody>
            </table>
        </div>







在该表中,Gender是一个列表值..有没有办法可以使用jquery在表格行中显示所选值以及其他数据



性别在html中是硬编码的






In that table Gender is a list value .. is there a way i can show the selected value in the table row along with other data using jquery

Gender is hardcoded in html's

<select class="form-control" tabindex="23" id="ddlSex">
                    <option value="0">Select</option>
                    <option value="M">Male</option>
                    <option value="F">Female</option>
                </select>







当我试图这样做时......它显示了表格中选定值的价值




when i tried to do it.. it is showing the value of that selected one in the table

like Gender = M instead of Male





分配所选的值如下:性别: $(ddlSex)。val()



将所有细节传递到桌子





assigning the selected value like this Sex: $("ddlSex").val(),

passing all the details to a table

$.each(Details, function (i, item) {
                var memberModel = [
                    item.Name,
                    item.Years,
                    item.Months,
                    item.Gender,
                    item.Number,
                    item.Number2,
                    item.Number3,
                ];
                DetailsArray.push(memberModel);

            });
        var thisTable = $('#member').dataTable();
            thisTable.fnClearTable();
            thisTable.fnAddData(DetailsArray);
            thisTable.bDeferRender = true;



任何人都可以在这里帮助plz


Can anyone help here plz

推荐答案





任何人都可以在这里帮助plz


Can anyone help here plz


这篇关于绑定列表值到表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 21:19