I'm trying to implement xeditable ([xeditable1) with a Bootstrap 4 table. I am trying to emulate this snippet (https://bbbootstrap.com/snippets/edit-forms-inline-using-x-editable-editor-11973728) with no luck. Here is what I have in my index.php file:
<th data-field="macAddr_id" data-sortable="true" data-filter-control="input" data-editable="true">Mac Address</th>
........................
<?php
while($row = $result->fetch_assoc()) { ?>
<tr>
<td> <a href="#" id="macAddr" data-type="text" data-pk="1" class="editable editable-click editable-empty" data-abc="true"><?php echo $row["macAddr_id"]; ?></a> </div>
</tr>
The table is displayed fine. In my index.js (which I include in my index.php file),I have:
$('#macAddr').editable({
mode: 'inline',
type: 'text',
name: 'macAddr',
pk: 1
});
But editing does not work. When I single-click or double-click, I get nothing.
I have tried multiple versions of x-editable, including:
https://github.com/Talv/x-editable
https://vitalets.github.io/x-editable/index.html (jquery version)
Neither works. Is there something I am missing? Or a better plugin to use?
As your
atags is inside while loop so same id will get assign to eachatag . Instead change that toclass="macAddr". Then , use each loop to iterate and initialize editable plugin to eachatags withclass="macAddr".Demo Code :