datatable cell.data ---输入表单

时间:2015-12-13 13:22:21

标签: jquery ajax html5 datatables

我有这个页面:

<input type="text" class="form-control" >id="ButonSociete"name="ButonSociete"placeholder="Societe"> <table cellpadding="0" cellspacing="0" border="0" class="display" >id="demande" width="100%">
                <thead>
                    <tr>
                        <th>Nom</th>
                        <th>Prenom</th>
                        <th>Societe</th>
                        <th>Email</th>
                        <th>Telephone</th>
                        <th>Fax</th>
                        <th>Adresse</th>
                        <th>Date</th>
                        <th>Createdby</th>
                    </tr>
                </thead>            </table>

我使用这个数据表使用这个JS文件向表中添加数据:

var table = $('#demande').DataTable     (       {           dom: 'Bfrtip',          ajax: 'php/table.demande.php',          columns:            [

                {
                    "data": "Nom"
                },
                {
                    "data": "Prenom"
                },
                {
                    "data": "Societe"
                },
                {
                    "data": "Email"
                },
                {
                    "data": "Telephone"
                },
                {
                    "data": "Fax"
                },
                {
                    "data": "Adresse"
                },
                {
                    "data": "Date"
                },
                {
                    "data": "Createdby"

                }           ],          select: 'single',
                        buttons:            [
                { extend: 'edit',   editor: editor },
                {extend: "selectedSingle",
                    text: "Select",
                     action: function ( )
                    {
                    }
                }

            ]       }   );

当我点击&#39;选择&#39;按钮我想要输入&#34; ButonNom&#34;为了接收所选单元格中的数据,我尝试table.cell(selected,0).data();,但它没有工作。

1 个答案:

答案 0 :(得分:0)

我添加这个                         var contenu = table.cell('。selected',0).data();

                    $('input[name="ButonPrenom"]').val(contenu);

似乎正在运作