我有这个页面:
<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();
,但它没有工作。
答案 0 :(得分:0)
我添加这个 var contenu = table.cell('。selected',0).data();
$('input[name="ButonPrenom"]').val(contenu);
似乎正在运作