我正在使用DataTables和Jeditbale。一切似乎都很好,但是,由於某種原因,當我雙擊表中的任何字段時,它都包含HTML。我在這裏插入了視覺。我還沒有嘗試過任何解決這個問題的方法,因爲我甚至無法理解這將如何發生。我搜索了這個問題,但大多數報告類似問題的人報告了額外的空格;沒有完整的HTML字段。我怎樣才能解決這個問題?如果需要額外的代碼,可以在適當的時候添加。 JQuery DataTables和Jeditable - 字段包含html,但不應該。爲什麼?
這裏是我的表碼:
<!-- start table listing -->
<table id="myTable" class="stripe hover cell-border row-border">
<thead>
<tr>
<th id="country_id">Country ID</th>
<th id="country">Country Name</th>
<th id="country_import">Import Commnents</th>
<th id="country_export">Export Comments</th>
<th id="country_date_created">Created</th>
<th id="country_date_updated">Updated</th>
<th id="">Updated by</th>
<th id="country_enabled">Enabled?</th>
<th id="">Actions</th>
</tr>
</thead>
<tbody>
<?php
foreach ($query as $row) {
?>
<tr <?php echo 'id="'.$row->country_id.'"'; ?> >
<td>
<?php echo $row->country_id; ?>
</td>
<td>
<a class='table-action-deletelink' href='/admin/country_view/<?php echo ''.$row->country_id.''; ?> '><?php echo $row->country; ?></a>
</td>
<td>
<?php echo $row->country_import_comments; ?>
</td>
<td>
<?php echo $row->country_export_comments; ?>
</td>
<td>
<?php echo $row->country_date_created; ?>
</td>
<td>
<?php echo $row->country_date_last_updated; ?>
</td>
<td>
<?php echo $row->country_updated_by; ?>
</td>
<td> <?php
if ($row->country_enabled == 1) {
echo '<span class="glyphicon glyphicon-ok" aria-hidden="true" ></span>';
} else {
echo '<span class="glyphicon glyphicon-remove" aria-hidden="true" ></span>';
} ?>
</td>
<td>
<!-- main container -->
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
Dropdown
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="/admin/country_view/<?php echo ''.$row->country_id.''; ?>">View</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Edit</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">Deactivate</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="/admin/country_delete/<?php echo ''.$row->country_id.''; ?> ">Delete</a></li>
</ul>
</div>
</td>
</form>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
這裏是我的javascript實現表:
$(document).ready(function() {
//sDeleteURL: "/Home/DeleteData.php"
$('#myTable').dataTable().makeEditable({
// some basic config
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': "admin/json_get_countries",
stateSave: true,
"scrollCollapse": true,
"language": {
"lengthMenu": "Display _MENU_ records per page",
"zeroRecords": "Nothing found - sorry",
"info": "Showing page _PAGE_ of _PAGES_",
"infoEmpty": "No records available",
"infoFiltered": "(filtered from _MAX_ total records)"
}
});
}); // end of on doc load
顯示您的代碼。 – Viral
你可以顯示代碼如何構建? –