Jez
Jez

Reputation: 260

X-Editable & PHP MySQL tables

I'm looking at using X-Editable in my tables, when I pull the table data through from the database, that works all fine, my issue is when I add the X-Editable to it, the first row is only the row that is editable.

All the other rows are showing under a hyperlink but dont have the dashed line underneath, and when click on them they just put the # in the address bar after the *.php

What have I missed to be able have all rows editable?

<table id="userinfo" class="table table-bordered table-striped">
<thead>
 <tr>
    <th>Name</th>
    <th>MeetingStart</th>
    <th>Details</th>
</tr>
</thead>
<tbody>
<?php
    $info = db::getInstance()->query('SELECT * FROM information');
    foreach ($info->results() as $info) {
?>
<tr>
    <td>
        <a href="#" id="groupname" data-type="select" data-pk="1" data-value="5" data-source="/groups" data-original-title="Select group">
            <?php echo $info->name; ?>
        </a>
    </td>
    <td>
        <a href="#" id="meeting_start" data-type="datetime" data-pk="1" data-url="/post" data-placement="right" title="Set date & time">                                                            
            <?php echo $info->meetingstart; ?>
        </a>
    </td>
    <td><?php echo $info->details; ?></td>
</tr>
<?php }; ?>
</tbody>

Screenshot of the problem X-Editable issue

Upvotes: 0

Views: 882

Answers (1)

Marc B
Marc B

Reputation: 360892

Duplicate DOM ID's:

foreach(...) {
    <a href="#" id="groupname" 
                    ^^^^^^^^^

Since DOM IDs MUST be unique, the system is properly stopping when it finds the first matching DOM node. You're outputting the SAME id for every row in your table.

Upvotes: 2

Related Questions